[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ideas
Subject:    [Python-ideas] Re: set arbitrary hash random seed to ensure reproducible results
From:       Chris Angelico <rosuav () gmail ! com>
Date:       2021-12-23 14:53:03
Message-ID: CAPTjJmoF8E+JYPG5h_0S_A9+F_CTDM+Jxv-jwFx+GphuEBX+tQ () mail ! gmail ! com
[Download RAW message or body]

On Fri, Dec 24, 2021 at 12:14 AM Hao Hu <hao.hu.fr@gmail.com> wrote:
> - generalize the signature of __hash__(object) to __hash__(object,
> *args, **kwargs). In the default implementation, we discard the keyword
> "salt" and use the default fallback salt if the keyword is not present,
> otherwise we use the salt specified by the keyword.
> 

That means that EVERY __hash__ implementation that calls hash() MUST
pass along all spare arguments. This is a breaking change that will
affect a lot of third-party code.

Changing a dunder's signature is a very big deal and needs a lot more
justification than this.

How important *is* it to be able to lock in the seed/salt (they're not
the same thing) when hashing arbitrary objects?

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/XAZIFH4GHWIREGIGU5KHGZJJM3Y6NDJZ/
 Code of Conduct: http://python.org/psf/codeofconduct/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic