This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients jackdied, michael.foord, ncoghlan, rhettinger
Date 2010-07-10.07:59:57
SpamBayes Score 0.00020689933
Marked as misclassified No
Message-id <1278748800.3.0.443699388896.issue9110@psf.upfronthosting.co.za>
In-reply-to
Content
The idea of building this into contextlib actually came out on off-list discussion between Michael and I. To quote the original suggestion he sent to me:

"""What do you think about adding ContextDecorator to contextlib for Python 3.2?

    http://pypi.python.org/pypi/contextdecorator

It's a simple recipe but useful nonetheless (and Barry Warsaw at least is very enthusiastic about it ;-).

ContextDecorator allows you to create APIs that behave as both context managers and as decorators. It also provides the optional exception handling capability of __exit__ for decorators. This isn't an uncommon pattern, used in libraries like mock, py.test and django, and it is at least slightly fiddly to get right."""

I agree it is good to have that additional motivation (and the reference to previous work) here in the tracker issue rather than squirreled away in a couple of private email archives.
History
Date User Action Args
2010-07-10 08:00:00ncoghlansetrecipients: + ncoghlan, rhettinger, jackdied, michael.foord
2010-07-10 08:00:00ncoghlansetmessageid: <1278748800.3.0.443699388896.issue9110@psf.upfronthosting.co.za>
2010-07-10 07:59:58ncoghlanlinkissue9110 messages
2010-07-10 07:59:57ncoghlancreate