Message109833
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. |
|
Date |
User |
Action |
Args |
2010-07-10 08:00:00 | ncoghlan | set | recipients:
+ ncoghlan, rhettinger, jackdied, michael.foord |
2010-07-10 08:00:00 | ncoghlan | set | messageid: <1278748800.3.0.443699388896.issue9110@psf.upfronthosting.co.za> |
2010-07-10 07:59:58 | ncoghlan | link | issue9110 messages |
2010-07-10 07:59:57 | ncoghlan | create | |
|