weak reference to bound method
ole-usenet-spam at gmx.net
Fri Oct 2 10:54:11 CEST 2009
I am trying to use a weak reference to a bound method:
o = MyClass()
>>>> <bound method MyClass.myfunc of <__main__.MyClass object at 0xc675d0>>
r = weakref.ref(o.myfunc)
This is what I do not understand. The object "o" is still alive, and
therefore the bound method "o.myfunc" shall exists.
Why does the weak reference claim that it is removed? And how can I hold
the reference to the method until the object is removed?
Is this a bug or a feature? (Python 2.6)
More information about the Python-list