bpo-46270: Describe the in and not in operators as membership tests. (GH-30504)

This commit is contained in:
Raymond Hettinger 2022-01-09 20:02:06 -06:00 committed by GitHub
parent 0b2b9d2513
commit d24cd49acb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -659,10 +659,12 @@ More on Conditions
The conditions used in ``while`` and ``if`` statements can contain any The conditions used in ``while`` and ``if`` statements can contain any
operators, not just comparisons. 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 The comparison operators ``in`` and ``not in`` are membership tests that
whether two objects are really the same object. All comparison operators have determine whether a value is in (or not in) a container. The operators ``is``
the same priority, which is lower than that of all numerical operators. 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 Comparisons can be chained. For example, ``a < b == c`` tests whether ``a`` is
less than ``b`` and moreover ``b`` equals ``c``. less than ``b`` and moreover ``b`` equals ``c``.