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 jaraco
Recipients jaraco
Date 2017-11-28.19:39:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1511897986.14.0.213398074469.issue32158@psf.upfronthosting.co.za>
In-reply-to
Content
The contextlib docs explain why a decorator is nice:

> 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).

However, the built-in context managers that could readily supply this interface don't derive from DecoratorContext.

In jaraco.context, I [added decorator support by simply deriving from the two base classes](https://github.com/jaraco/jaraco.context/commit/5aa7b0bb222cff5009a2f0dc3ea49db9e7a6b71a#diff-efbedfbbcb7f61268cfeff04a32fa59d).

But it got me thinking - couldn't suppress (and possibly other) contextlib decorators support this usage out of the box?

If there's interest, I'll put together a patch with test.
History
Date User Action Args
2017-11-28 19:39:46jaracosetrecipients: + jaraco
2017-11-28 19:39:46jaracosetmessageid: <1511897986.14.0.213398074469.issue32158@psf.upfronthosting.co.za>
2017-11-28 19:39:46jaracolinkissue32158 messages
2017-11-28 19:39:46jaracocreate