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

Guido van Rossum guido at python.org
Fri Apr 21 20:47:05 CEST 2006


On 4/21/06, A.M. Kuchling <amk at amk.ca> wrote:
> On Fri, Apr 21, 2006 at 06:54:11PM +0100, Guido van Rossum wrote:
> > Phillip, I do recomment you look at decimal.py. If we're not reversing
> > the PEP changes, that module needs to be changed; it has a class
> > Context (that was always there) with a __context__ method which
> > returns an instance of a class ContextManager (newly created for the
> > with-statement). This looks backwards from the PEP's current POV.
>
> Does this detail matter to users of the Decimal module, though?  Those
> users may well be thinking using the term 'context'.  That the
> underlying 'with' details use the term differently doesn't matter to
> module users, only to the implementors of decimal.Context.

Half and half. I'm not proposing to rename Context (which is already
well known). But ContextManager is brand new and uses the confused
terminology, so perhaps ought to be renamed to something else (and it
should probably get a leading underscore too, lest people start
instantiating it).

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list