[Greg Ewing] >> Maybe the callback shouldn't be passed the weakref object? >> I don't see what good that does anyway, since the weakref >> is just an empty shell by then, isn't it? [Jim Fulton] > No. It can still be used as a key. It still has it's original > hash value and will compare equal to other weakrefs to the same > original object. Weak-key dictionaries depend on this. Right. > In addition, as Tim points out, it could be a weakref-subclass instance > and could have additional useful data. Adn weak-value dictionaries depend on that; from weakref.py: class KeyedRef(ref): """Specialized reference that includes a key corresponding to the value. This is used in the WeakValueDictionary to avoid having to create a function object for each key stored in the mapping. A shared callback object can use the 'key' attribute of a KeyedRef instead of getting a reference to the key from an enclosing scope. """ ...
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