Re: using modules in destructors

2008-10-28 Thread MRAB
On Oct 27, 5:40 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > It seems to me that deleting local instances before imported modules > > would solve the problem. Is it not possible for the interpreter to get > > this right? Or are there cases where this would break

Re: using modules in destructors

2008-10-27 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: It seems to me that deleting local instances before imported modules would solve the problem. Is it not possible for the interpreter to get this right? Or are there cases where this would break stuff. It seems rather unpythonic for the __del__() method to become unpredic

Re: using modules in destructors

2008-10-25 Thread [EMAIL PROTECTED]
It seems to me that deleting local instances before imported modules would solve the problem. Is it not possible for the interpreter to get this right? Or are there cases where this would break stuff. It seems rather unpythonic for the __del__() method to become unpredictable at exit. -- http://ma

Re: using modules in destructors

2008-10-24 Thread Michele Simionato
This is expected behavior (see http://www.python.org/doc/essays/cleanup) but it is definitely a wart of Python. The best advice I can give you is *never* use __del__. There are alternatives, such as the with statement, weak references or atexit. See for instance http://code.activestate.com/recipes

using modules in destructors

2008-10-24 Thread [EMAIL PROTECTED]
Hi i have i have a class that makes temp folders to do work in. it keeps track of them, so that in the __del__() it can clean them up. ideally if the user of the module still has objects left at the end of their program, they should be automatically cleaned up. in my destructor i had a call to shu