[Python-Dev] Marking GC details as CPython-only (original) (raw)

Barry Warsaw barry at python.org
Wed Feb 13 21:43:28 CET 2013


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



More information about the Python-Dev mailing list