[issue46684] Expose frozenset._hash classmethod
Joshua Bronson
report at bugs.python.org
Tue Feb 8 17:57:39 EST 2022
Joshua Bronson <jabronson at gmail.com> added the comment:
Thanks for the explanation, Raymond.
Regarding:
> Lastly, pure python hashable sets based on the ABC are not common
This would have implications for other use cases though, that are perhaps more common.
See, for example, the following code: https://github.com/jab/bidict/blob/ae9d06/bidict/_frozenbidict.py#L36-L38
This example demonstrates an implementation of a hashable, immutable Mapping type, whose __hash__ implementation returns collections.abc.ItemsView(self)._hash(). Since there are several other libraries I know of that implement hashable/immutable mapping types as well, I thought this might be beneficial enough to users to warrant consideration.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46684>
_______________________________________
More information about the Python-bugs-list
mailing list