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://mail.python.org/mailman/listinfo/python-list