Message406490
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:30 | rhettinger | set | recipients:
+ rhettinger, ezio.melotti, eric.araujo, docs@python, willingc, mdk, harahu |
2021-11-17 20:29:30 | rhettinger | set | messageid: <1637180970.15.0.439716528846.issue45832@roundup.psfhosted.org> |
2021-11-17 20:29:30 | rhettinger | link | issue45832 messages |
2021-11-17 20:29:30 | rhettinger | create | |
|