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

Terry Reedy tjreedy at udel.edu
Sun Apr 23 20:10:54 CEST 2006


"Baptiste Carvello" <baptiste13 at altern.org> wrote in message 
news:e2fr6f$q9c$1 at sea.gmane.org...
>+1 for context maker.

[me, Terry]
>> 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,

I believe so, either that or, for short, context

>and the object with just __context__ is a context maker ?

If that is what goes after 'with', yes.

>If so , I would say the decorator still produces a context manager.

If I misunderstood what the decorator produces, then @contextmaker would be 
wrong.  Actually, I thought there were possibly two decorators under 
consideration, one for each.

Terry Jan Reedy


Baptiste

_______________________________________________
Python-Dev mailing list
Python-Dev at python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org





More information about the Python-Dev mailing list