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 rhettinger
Recipients docs@python, eric.araujo, ezio.melotti, harahu, mdk, rhettinger, willingc
Date 2021-11-17.20:29:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This section presumes that the usual hash invariant holds:  a==b implies hash(a)==hash(b).  We could repeat that here but I don't think it makes the docs better or more useable to require that docs repeat the same facts in multiple places.

Alternatively, the sentence could be split to cover both cases:

For sequence 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 that use hashing, such as dict, set, or frozenset, 
the expression `x in y` is equivalent to `any(x is e or x == e for e in y if hash(x) == hash(e))`.

While that is more precise, it borders on being pedantic and likely doesn't make the average reader better off.

Consider submitting a feature request to pandas suggesting that they harmonize their hash functions with their counterparts in numpy.
Date User Action Args
2021-11-17 20:29:30rhettingersetrecipients: + rhettinger, ezio.melotti, eric.araujo, docs@python, willingc, mdk, harahu
2021-11-17 20:29:30rhettingersetmessageid: <>
2021-11-17 20:29:30rhettingerlinkissue45832 messages
2021-11-17 20:29:30rhettingercreate