[Python-Dev] Why are contexts also managers? (wasr45544 -peps/trunk/pep-0343.txt)
Baptiste Carvello
baptiste13 at altern.org
Sun Apr 23 14:10:58 CEST 2006
Terry Reedy a écrit :
> So I propose that the context maker be called just that: 'context maker'.
> That should pretty clearly not be the context that manages the block
> execution.
>
+1 for context maker. In fact, after reading the begining of the thread, I came
up with the very same idea.
> Similar, a context_maker function could be named any of 'context_maker',
> 'context_manager', or 'context', with the latter two referring to the
> return value. In the context of 'with ____ as name:', either of the latter
> two reads better to me.
>
> I would call the decorator @contextmaker since that is what it turns the
> decorated function into.
>
I'm confused here. Do we agree that the object with __enter__ and __exit__ is a
context manager, and the object with just __context__ is a context maker ?
If so , I would say the decorator still produces a context manager.
Baptiste
More information about the Python-Dev
mailing list