Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

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.

----------
nosy: +rhettinger

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

Reply via email to