Why doesn't the weakref work on this bound method?
I have a project where i'm trying to use weakrefs with callbacks, and I don't understand what I'm doing wrong. I have created simplified test that shows the exact behavior i'm confused with. Why is it that in this test test_a works as expected, but the weakref for self.MyCallbackB disappears between the class initialization and calling test_b? I thought like as long as the instance (a) exists, the reference to self.MyCallbackB should exist, but it doesn't. import weakref class A(object): def __init__(self): def MyCallbackA(): print 'MyCallbackA' self.MyCallbackA = MyCallbackA self._testA =