Hacker News new | ask | show | jobs
by aiiane 4961 days ago
Why not just add an atexit trap that automatically cleans up open logs?

http://docs.python.org/2/library/atexit.html

2 comments

I am fairly sure that most of the streams and sockets would get closed when the interpreter exited regardless.

Also, in accordance to the principle of "explicit is better than implicit," it's generally better to avoid messing with global state (such as atexit) behind the scenes, and to provide a way to shut down the logs manually.

LeafStorm got to it before me :)