[Python-Dev] More on contextlib - adding back a contextmanager decorator
fredrik at pythonware.com
Mon May 1 13:39:26 CEST 2006
Greg Ewing wrote:
> I've been thinking about the terms "guarded context"
> and "context guard". We could say that the with-statement
> executes its body in a guarded context (an abstract
> notion, not a concrete object). To do this, it creates
> a context guard (a concrete object) with __enter__
> and __exit__ methods that set up and tear down the
> guarded context. This seems clearer to me, since I
> can more readily visualise a "guard" object being
> specially commissioned to deal with one particular
> job (guarding a particular invocation of a context).
> With only one object, there wouldn't be a need for any more
contrast and compare:
a distinct term for "whatever the __enter__ method returns" (i.e.
the thing assigned to the target list) would still be nice.
More information about the Python-Dev