On Nov 2, 2004, at 11:40 PM, Tim Peters wrote: > a reachable callback can have visible effects, and there > really isn't ambiguity about which of c and W "dies first" (c does) in > the example. An unreachable callback function can also have visible effects. > The question is whether gc should really be looking at whether the > weakref *callback* is reachable, regardless of whether the weakref > itself is reachable (if the weakref is reachable, its callback is too, > and 2.4b2 invokes it -- the only case in question is the one in the > example, where the weakref and the weakref's referent are unreachable > but the weakref's callback is reachable). From what I'm hearing here, the following two pieces of code would then have different behavior under patch-callback: """ def C_gone(ignored): print "An object of type C went away." class C: def __init__(self): self.wr = weakref.ref(self, C_gone) """ and """ class C: def __init__(self): def C_gone(ignored): print "An object of type C went away." self.wr = weakref.ref(self, C_gone) """ If that's correct, it sounds like a bad idea to me. James
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