Duncan Booth schrieb: > What is less obvious is that new style classes always include circular > references, so a class is never detroyed until the garbage collector runs.
Thanks. I tried the same example with old style classes and A.__del__ gets correctly called. > Of course, if your __del__ method actually does get invoked during program > exit you have to be pretty careful what you do: the chances are any global > variables you used in __del__ have already been destroyed in particular any > modules you imported may have been deleted. In short, don't rely on > anything much being possible from __del__ called this way. I wanted to close a database connection, which is opend by __init__. But what happens to my database connection (instance attributes of A) when __del__ is never called? -- Greg -- http://mail.python.org/mailman/listinfo/python-list