diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 122ed00..9ad33f3 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -135,8 +135,10 @@ Comparisons operator: != operator: is operator: is not + operator: in + operator: not in -There are eight comparison operations in Python. They all have the same +There are ten comparison operations in Python. They all have the same priority (which is higher than that of the Boolean operations). Comparisons can be chained arbitrarily; for example, ``x < y <= z`` is equivalent to ``x < y and y <= z``, except that *y* is evaluated only once (but in both cases *z* is not @@ -163,6 +165,10 @@ This table summarizes the comparison operations: +------------+-------------------------+ | ``is not`` | negated object identity | +------------+-------------------------+ +| ``in`` | membership | +-------------+-------------------------+ +| ``not in`` | negated membership | ++------------+-------------------------+ .. index:: pair: object; numeric @@ -201,8 +207,9 @@ exception. operator: in operator: not in -Two more operations with the same syntactic priority, :keyword:`in` and -:keyword:`not in`, are supported only by sequence types (below). +The operations :keyword:`in` and :keyword:`not in`, are supported by +sequences, sets, mappings, and can be customized by any class which defines +the :meth:`__contains__` method. .. _typesnumeric: