[Python-ideas] incremental hashing in __hash__
jab at math.brown.edu
jab at math.brown.edu
Wed Jan 4 16:38:05 EST 2017
Instead of the proposals like "hash.from_iterable()", would it make sense
to allow tuple.__hash__() to accept any iterable, when called as a
classmethod? (And similarly with frozenset.__hash__(), so that the fast C
implementation of that algorithm could be used, rather than the slow
collections.Set._hash() implementation. Then the duplicated implementation
in _collections_abc.py's Set._hash() could be removed completely,
delegating to frozenset.__hash__() instead.)
Would this API more cleanly communicate the algorithm being used and the
implementation, while making a smaller increase in API surface area
compared to introducing a new function?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170104/8823aae1/attachment.html>
More information about the Python-ideas
mailing list