Message175378
Dead weakrefs to a given object happen to be equal if they don't have a callback, but unequal if they do. However, they are always equal when alive: >>> class O: pass ... >>> o = O() >>> def cb(_): pass ... >>> q = weakref.ref(o) >>> r = weakref.ref(o) >>> s = weakref.ref(o, cb) >>> t = weakref.ref(o, cb) >>> q == r True >>> s == t True >>> del o >>> q() is None True >>> q == r True >>> s == t False This may be related to the following optimization (?): >>> q is r True >>> s is t False | |
| Date | User | Action | Args | | 2012-11-11 18:07:35 | pitrou | set | recipients: + pitrou, tim.peters, fdrake | | 2012-11-11 18:07:35 | pitrou | set | messageid: <1352657255.44.0.0509101223416.issue16453@psf.upfronthosting.co.za> | | 2012-11-11 18:07:35 | pitrou | link | issue16453 messages | | 2012-11-11 18:07:35 | pitrou | create | | |