is there anybody using __del__ correctly??

greg greg at cosc.canterbury.ac.nz
Fri Aug 10 05:28:39 EDT 2007


Michele Simionato wrote:
> So I did, and to my dismay 95% of the __del__ methods in the standard
> library are just calling a close method!

You can't conclude that this is wrong just from
looking at the __del__ method itself. You need to
consider whether there is any way the thing being
closed could be referenced from somewhere else.

If that's so, the __del__ method may be performing
a useful service by closing it more promptly than
it would otherwise be.

--
Greg



More information about the Python-list mailing list