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

Carl Banks pavlovevidence at gmail.com
Sun May 17 01:33:47 EDT 2009


On May 16, 8:20 pm, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> Carl Banks <pavlovevide... at gmail.com> writes:
> > 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()
>
> Yes, that's a precedent in favour of “silently return immediately when
> closing an already-closed DaemonContext”. I'm not about to assume that
> it's the *only* relevant precedent.

I don't think this is anything more than a trivial consideration,
which should warrant nothing more than the simplest solution possible,
which is to simply allow multiple clean up calls.

That one of Python's most fundamental types allows its clean-up
operation to be invoked safely on an already-cleaned up object is
precedent enough, given the triviality of the issue.

You're welcome to your own assessment of the problem's importance.


Carl Banks



More information about the Python-list mailing list