[docs] [issue28617] Why isn't "in" called a comparison operation?

wim glenn report at bugs.python.org
Fri Nov 4 16:36:00 EDT 2016


New submission from wim glenn:

Regarding 

    https://docs.python.org/3/library/stdtypes.html#comparisons

There is a line at the bottom claiming:

> Two more operations with the same syntactic priority, in and not in, are supported only by sequence types (below).

The claim is incorrect because `in` and `not in` are also supported by non-sequence types such as sets, mappings, etc for membership testing.

Is there any good reason why we don't include them in the table of comparison operations, and say that there are ten comparison operations in python?  They do support comparison chaining in the same way: 

    >>> 'x' in 'xy' in 'xyz'
    True
    >>> 0 in {0} in [{0}]
    True

----------
assignee: docs at python
components: Documentation
files: patch.diff
keywords: patch
messages: 280080
nosy: docs at python, wim.glenn
priority: normal
severity: normal
status: open
title: Why isn't "in" called a comparison operation?
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45359/patch.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28617>
_______________________________________


More information about the docs mailing list