Magnus Carlsson added the comment:

"The solution to that is to always have a test that your decorator actually 
returns a function. That's what I do."

Yes, I agree that with more tests I would have found the problem, but sometimes 
you forget things. And to me I want the tests to fail by default or for cases 
that are unspecified.

I think the sentinel solution would come a long way of solving both the issue 
that I reported but still keep the context solution intact.

Out of curiosity, would it be a solution to have the sentinel be a real 
function?

def _sentinel():
    pass

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24134>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to