__del__ and reference count problem

ajikoe at gmail.com ajikoe at gmail.com
Thu Apr 21 14:18:24 EDT 2005


Your problem can be simplified :

class A:
  pop = 11
  def __del__(self):
    print A.pop

if __name__ == '__main__':
  objA = A()

Exception exceptions.AttributeError: "'NoneType' object has no
attribute 'pop'" in <bound method A.__del__ of <__main__.A instance at
0x01474A08>> ignored

I got the same error message, and I don't know why ? it looks like the
class variable can't be accessed from __del__?


Pujo




More information about the Python-list mailing list