Terry J. Reedy added the comment:

Here is a more accurate 'equivalent': "any(x is e or <one of x==e or e==x> for 
e in <candidate members of y>)" where 'candidate members' is "members with the 
same hash as x" for built-in hash-based collections and 'all members' for 
built-in unsorted sequences".  I am sure that built-in range does a direct 
calculation.  Instead of the above, I suggest this.

"For general collections, such as list, tuple, collections.deque, and most 
iterables, the expression `x in y` is usually equivalent to `any(x is e or x == 
e for e in y)`."

Hash-based collections should not be mentioned in such a sentence as the 
equivalency is completely wrong, as Steven noted.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27605>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to