Fredrik Lundh wrote: > "Warning: Due to the precarious circumstances under which __del__() > methods are invoked, exceptions that occur during their execution are > ignored, and a warning is printed to sys.stderr instead. Also, when > __del__() is invoked in response to a module being deleted (e.g., > when execution of the program is done), other globals referenced by > the __del__() method may already have been deleted. For this > reason, __del__() methods should do the absolute minimum needed > to maintain external invariants."
Jeff Epler wrote: > *ÂÂÂÂÂÂÂBugsÂandÂcaveats:ÂTheÂdestructionÂofÂmodulesÂandÂobjectsÂin > modulesÂis > *ÂÂÂÂÂÂÂdoneÂinÂrandomÂorder;ÂthisÂmayÂcauseÂdestructors > (__del__()Âmethods)Âto > *ÂÂÂÂÂÂÂfailÂwhenÂtheyÂdependÂonÂotherÂobjects > (evenÂfunctions)ÂorÂmodules. 2 Questions... 1) Why does this never happen in C++? Or does it, its just never happened to me? 2) I can understand random destruction of instantiated objects, but I find it weird that class definitions (sorry, bad terminology) are destroyed at the same time. So __del__ can't safely instantiate any classes if its being called as a result of interpreter shutdown? Boo... Oh well, thanks for the help...now I know. -- http://mail.python.org/mailman/listinfo/python-list