Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:

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.

----------
nosy: +rhettinger

_______________________________________
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

Reply via email to