[Tim] > The object's id() (address) is the key. Else only hashable objects > could be pickled. [Greg Ewing] > Hmmm, I see. > > It occurs to me that what you really want here is a special > kind of dictionary that uses "is" instead of "==" to compare > key values. Possibly. The *effect* of that could be gotten via a wrapper object, like class KeyViaId: def __init__(self, obj): self.obj = obj def __hash__(self): return hash(id(self.obj)) def __eq__(self, other): return self.obj is other.obj but if Martin is worried about two-tuple sizes, he's not going to fall in love with that. > Or is that what was meant by an "identity dictionary"? Guido asked, but if Martin answered that question I haven't seen it yet.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4