diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2022-01-10 02:02:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-10 02:02:06 (GMT) |
commit | d24cd49acb25c36db31893b84d0ca4fe2f373b94 (patch) | |
tree | 6c7c3cc788bc07394a65cf2f2cf08575505282a6 | |
parent | 0b2b9d251374c5ed94265e28039f82b37d039e3e (diff) | |
download | cpython-d24cd49acb25c36db31893b84d0ca4fe2f373b94.zip cpython-d24cd49acb25c36db31893b84d0ca4fe2f373b94.tar.gz cpython-d24cd49acb25c36db31893b84d0ca4fe2f373b94.tar.bz2 |
bpo-46270: Describe the `in` and `not in` operators as membership tests. (GH-30504)
-rw-r--r-- | Doc/tutorial/datastructures.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index e42b380..927a672 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -659,10 +659,12 @@ More on Conditions The conditions used in ``while`` and ``if`` statements can contain any operators, not just comparisons. -The comparison operators ``in`` and ``not in`` check whether a value occurs -(does not occur) in a sequence. The operators ``is`` and ``is not`` compare -whether two objects are really the same object. All comparison operators have -the same priority, which is lower than that of all numerical operators. + +The comparison operators ``in`` and ``not in`` are membership tests that +determine whether a value is in (or not in) a container. The operators ``is`` +and ``is not`` compare whether two objects are really the same object. All +comparison operators have the same priority, which is lower than that of all +numerical operators. Comparisons can be chained. For example, ``a < b == c`` tests whether ``a`` is less than ``b`` and moreover ``b`` equals ``c``. |