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

A.M. Kuchling amk at amk.ca
Fri Apr 21 21:45:51 CEST 2006


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.

--amk


More information about the Python-Dev mailing list