[Python-Dev] Why are contexts also managers? (wasr45544 -peps/trunk/pep-0343.txt) (original) (raw)
Baptiste Carvello baptiste13 at altern.org
Sun Apr 23 14:10:58 CEST 2006
- Previous message: [Python-Dev] Why are contexts also managers? (wasr45544 -peps/trunk/pep-0343.txt)
- Next message: [Python-Dev] Why are contexts also managers? (wasr45544 -peps/trunk/pep-0343.txt)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 contextmaker function could be named any of 'contextmaker', 'contextmanager', 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
- Previous message: [Python-Dev] Why are contexts also managers? (wasr45544 -peps/trunk/pep-0343.txt)
- Next message: [Python-Dev] Why are contexts also managers? (wasr45544 -peps/trunk/pep-0343.txt)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]