reorx
6/18/2013 - 6:09 AM

question about `del` in Python

question about del in Python

>>> class A(object):
...     def a(self):
...         print 'a'
... 
>>> ins = A()
>>> ins
<__main__.A object at 0x7f539e012250>
>>> ins.a
<bound method A.a of <__main__.A object at 0x7f539e012250>>
>>> l = []
>>> l.append(ins.a)
>>> l
[<bound method A.a of <__main__.A object at 0x7f539e012250>>]
>>> del ins
>>> l
[<bound method A.a of <__main__.A object at 0x7f539e012250>>]
>>> m = l[0]
>>> m
<bound method A.a of <__main__.A object at 0x7f539e012250>>
>>> m.
m.__call__(          m.__format__(        m.__init__(          m.__self__           m.im_class(
m.__class__(         m.__func__(          m.__new__(           m.__setattr__(       m.im_func(
m.__cmp__(           m.__get__(           m.__reduce__(        m.__sizeof__(        m.im_self
m.__delattr__(       m.__getattribute__(  m.__reduce_ex__(     m.__str__(           
m.__doc__            m.__hash__(          m.__repr__(          m.__subclasshook__(  
>>> m.im_self
<__main__.A object at 0x7f539e012250>