[Python-Dev] Why are contexts also managers? (was r45544 - peps/trunk/pep-0343.txt)

A.M. Kuchling amk at amk.ca
Wed Apr 19 16:21:05 CEST 2006


On Wed, Apr 19, 2006 at 11:10:55PM +1000, Nick Coghlan wrote:
> When Phillip went through to make the terminology consistent he actually 
> swapped the meanings of "context" (which meant 'has a __context__ method' 
> in the original PEP) and "context manager" (which meant 'has __enter__ and 
> __exit__ methods and a __context__ method that returns self' in the 
> original PEP).

Yes, that was exactly what he set out to do.  I noted that the terms
"context" and "context manager" seemed to be exactly reversed from
what's intuitive, and from how the user-facing documentation is
written; the post at
<http://mail.python.org/pipermail/python-dev/2006-April/063842.html>
contains my argument.  GvR approved, and Phillip went ahead and made
the change.

--amk


More information about the Python-Dev mailing list