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?
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to