Nick Coghlan <ncogh...@gmail.com> added the comment: One thing that Jack's confusion above does suggest to me is that we should mention in the *ContextDecorator* documentation that it is automatically applied to the context managers created when you use @contextmanager. A lot of people familiar with contextmanager are just going to read the docs for the new toy, so may miss the fact that we have added __call__ support to GeneratorContextManager.
As far as use cases go, 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 It makes it clear that the CM applies to the whole function, rather than just a piece of it (and saving an indentation level is nice, too). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9110> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com