Context manager, atexit processing, and PEP 3143 DaemonContext.close

Carl Banks pavlovevidence at gmail.com
Sat May 16 23:01:31 EDT 2009


On May 16, 5:50 pm, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> Ideas? How should this be addressed both Pythonically and respecting the
> intent of PEP 3143?


There's already precedent for what to do in the Python library.

Python 2.5.2 (r252:60911, Jan  4 2009, 17:40:26)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('somefile')
>>> f.close()
>>> f.close()
>>> f.close()
>>> f.close()


Is a context manager really necessary here?  It's not like daemon
processes can reattach themselves to the terminal when they're done
being a daemon.  What's the use case for being able to partially clean
up before program exit?


Carl Banks



More information about the Python-list mailing list