[EMAIL PROTECTED] wrote:

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__?

when Python shuts down, modules are sometimes cleaned out before objects created from classes in those modules. if you really need to access a global object during finalization, you have to hold on to it yourself.

   def __del__(self, A=A):
       print A.pop

(the best solution is to avoid using finalizers, of course, but that's another 
story)

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to