Re: keying by identity in dict and set

2019-10-28 Thread Steve White
an shed light on the internals of dict and set and their design goals, please do so! Thanks! On Sun, Oct 27, 2019 at 9:04 AM Chris Angelico wrote: > > On Sun, Oct 27, 2019 at 6:26 PM Steve White wrote: > > As near as I can tell, returning the id() in __hash__() results in a > &g

Re: keying by identity in dict and set

2019-10-27 Thread Steve White
layer is simply covering for a failing in the documentation. Thanks! On Sun, Oct 27, 2019 at 4:54 AM Random832 wrote: > > On Sat, Oct 19, 2019, at 07:31, Steve White wrote: > > Hi, > > > > I have an application that would benefit from object instances > > distinguish

Fwd: keying by identity in dict and set

2019-10-26 Thread Steve White
alled? * is it sufficient to return the value of the key object's id() function to produce a perfect hash? * when might it be useful to consider keying by identity? * what are the limitations of programming this way? Thanks! On Sat, Oct 26, 2019 at 7:17 AM dieter wrote: > > Steve White

Re: keying by identity in dict and set

2019-10-24 Thread Steve White
s! On Sat, Oct 19, 2019 at 1:31 PM Steve White wrote: > > Hi, > > I have an application that would benefit from object instances > distinguished by identity being used in dict's and set's. To do this, > the __hash__ method must be overridden, the obvious return value bei

Fwd: keying by identity in dict and set

2019-10-20 Thread Steve White
-- Forwarded message - From: Steve White Date: Sun, Oct 20, 2019 at 11:38 PM Subject: Re: keying by identity in dict and set To: Peter Otten <__pete...@web.de> Hi Peter, Thanks, that does seem to indicate something. (But there was no need to define a class... you'r

Re: keying by identity in dict and set

2019-10-20 Thread Steve White
On Sun, Oct 20, 2019 at 7:57 PM Peter Otten <__pete...@web.de> wrote: > > Steve White wrote: > > > > The point is, I don't think __eq__() is ever called in a situation as > > described in my post, yet the Python documentation states that if > > instances ar

Re: keying by identity in dict and set

2019-10-20 Thread Steve White
ouple of sentences in the documentation of __hash__ could fix the problem. Is that too much to hope for? How would I proceed to get somebody to look at this? Thanks! On Sun, Oct 20, 2019 at 5:16 PM Peter Otten <__pete...@web.de> wrote: > > Steve White wrote: > > > Hi Chris, > &g

Re: keying by identity in dict and set

2019-10-20 Thread Steve White
__hash__ (in the implementations of Python I have tested). Please try the code yourself. Tell me what I am missing. What "other problems"? Please provide an example! Thanks! On Sat, Oct 19, 2019 at 9:02 PM Chris Angelico wrote: > > On Sun, Oct 20, 2019 at 3:08 AM Steve Whit

keying by identity in dict and set

2019-10-19 Thread Steve White
Hi, I have an application that would benefit from object instances distinguished by identity being used in dict's and set's. To do this, the __hash__ method must be overridden, the obvious return value being the instance's id. This works flawlessly in extensive tests on several platforms, and on