Raymond Hettinger added the comment:

There is a separate report for taking care of the identity check for contains:  
https://bugs.python.org/issue23986

I think notes about crazy hashes shouldn't spill all over our docs.  At best, 
it warrants a FAQ entry about how hash tables work.

The risk here is that in an effort to be more precise, it is easy impair the 
usability of the docs.  The wording in question has been around for a very long 
time and has overall done a good job of explaining the intent of the 
in-operator to all but the most pedantic reader, "The operators 'in' and 'not 
in' test for membership. 'x in s' evaluates to true if x is a member of s, and 
false otherwise."

If you really want to be precise, the *only* thing that can be broadly stated 
about the in-operator is that it calls __contains__ on an object that that 
object can implement whatever logic it wants (hash table lookup, linear search, 
google search, random result, etc).  But then, this is no different than most 
magic methods in that regard.

----------
assignee: docs@python -> rhettinger
nosy: +rhettinger

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

Reply via email to