[issue9110] contextlib.ContextDecorator

Raymond Hettinger report at bugs.python.org
Sat Jul 10 11:00:54 CEST 2010


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

> this change is just syntactic sugar for
> any construct of the following form:
>
>  def f():
>    with cm():
>      # Do stuff
>
> ContextDecorator lets you instead write:
>
>  @cm
>  def f():
>    # Do stuff

Nicely expressed.  This ought to go directly into the documentation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9110>
_______________________________________


More information about the Python-bugs-list mailing list