This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients docs@python, eric.araujo, ethan.furman, ezio.melotti, georg.brandl, jonrsharpe
Date 2015-04-17.15:04:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
It's not quite that simple -- those containers use the hash to find the objects that will be first checked by identity, and then equality* -- otherwise they would have to do a complete scan from first key to last, and that would kill performance.


Okay, I see your point -- even for sane objects, a systematic check of every key is not undertaken for the hash-type containers.

Perhaps something like:

For container types such as list, tuple, or collections.deque, the expression 'x in y' is equivalent to 'any(x is e or x == e for e in y)'.  For container types such as set, frozenset, and dict, 'x in y' is equivalent to 'any(x is e or x == e for e in z)' where 'z' is a collection of objects in 'y' that have the same hash.
Date User Action Args
2015-04-17 15:04:40ethan.furmansetrecipients: + ethan.furman, georg.brandl, ezio.melotti, eric.araujo, docs@python, jonrsharpe
2015-04-17 15:04:40ethan.furmansetmessageid: <>
2015-04-17 15:04:40ethan.furmanlinkissue23987 messages
2015-04-17 15:04:40ethan.furmancreate