Why __hash__() does not return an UUID4?
Richard Damon
Richard at Damon-Family.org
Wed Aug 26 17:12:09 EDT 2020
On 8/26/20 4:10 PM, Marco Sulla wrote:
> As title. The reasons that came in my mind are:
>
> 1. speed
> 2. security
My guess is that the typical use of the value for __hash__() doesn't
need that level of guarantee of uniqueness, so requiring it would be
unnecessarily expensive.
Since the typical use of hash will be followed by a real equality test
if the hashes match, we don't need the level of a UUID
--
Richard Damon
More information about the Python-list
mailing list