On Feb 13, 2013, at 08:30 PM, Armin Rigo wrote:

>Actually right now, at the exit of the interpreter, we just leave the
>program without caring about running any __del__.  This might mean
>that in a short-running script no __del__ is ever run.  I'd add this
>question to your original list: is it good enough, or should we try
>harder to run destructors at the exit?

I've seen *tons* of small Python scripts that don't care about what happens,
if anything, at program exit.  Some have comments making that quite explicit.
Sometimes, they even do so as performance improvements!  When you care about
start up costs, you often also care about tear down costs.

Such scripts just expect that all their resources will get freed when the
process exits.  Of course, they're not always right (e.g. clean up tmp files),
but it's pretty common, and I'm sure not just in Python.  OTOH, relying on
__del__ to clean up your tmp files seems rather dubious (well, frankly, so
does most uses of __del__).

Cheers,
-Barry
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to