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 rhettinger
Recipients jackdied, michael.foord, ncoghlan, rhettinger
Date 2010-07-10.03:02:29
SpamBayes Score 0.00046174927
Marked as misclassified No
Message-id <1278730952.32.0.751766744004.issue9110@psf.upfronthosting.co.za>
In-reply-to
Content
I can shake the feeling that this is going to end-up being rarely used cruft that causes more confusion than its worth.  The use case and motivation isn't clear (why do context managers need to be both context managers and decorators)?

Has this decorator/contextmanager mix been used "in the wild" and shown any degree of popularity?  AFAICT, it doesn't seem to have come in newsgroup discussions, feature requests, utility modules, or a published recipe.  

Do we have any strong examples of code that is improved by the use of a decorating context manager?  

One issue for me is that my understanding of decorators (as function/classs wrappers) and of context managers (deeply associated with the with-statement) have no overlap.  ISTM, that code using both in the same object would be too clever by far, making it difficult to explain and difficult to debug.

Also, Jack's critiques seem valid to me -- too much machinery for too little benefit.
History
Date User Action Args
2010-07-10 03:02:32rhettingersetrecipients: + rhettinger, ncoghlan, jackdied, michael.foord
2010-07-10 03:02:32rhettingersetmessageid: <1278730952.32.0.751766744004.issue9110@psf.upfronthosting.co.za>
2010-07-10 03:02:30rhettingerlinkissue9110 messages
2010-07-10 03:02:29rhettingercreate