[Python-Dev] More on contextlib - adding back a contextmanagerdecorator

Fredrik Lundh fredrik at pythonware.com
Sun Apr 30 19:15:08 CEST 2006


Guido van Rossum wrote:

> I believe the context API design has gotten totally out of hand.
> I have a counter-proposal: let's drop __context__.

Heh. I was about to pull out the "if the implementation is hard to
explain, it's a bad idea (and bad ideas shouldn't go into 2.X)" rule
last week in response to the endless nick-phillip-paul "today I put
in my brain the other way" threads... ;-)

(but the design isn't really that hard to explain; it's just that ever-
one seems to be missing that there are three objects involved, not
two...)

But if you think we can get rid of the "with statement context
object" [1], I'm all for it.  "explicit is better than implicit" etc.

+1.

</F>

1) http://docs.python.org/dev/ref/with.html





More information about the Python-Dev mailing list