@decorator syntax is sugar, but for what exactly? (decorator libraries).

Andrew Durdin adurdin at gmail.com
Sun Aug 8 10:57:56 EDT 2004


On Sun, 08 Aug 2004 10:46:38 -0400, Roy Smith <roy at panix.com> wrote:
> In article <mailman.1360.1091975279.5135.python-list at python.org>,
> 
> Wow, I'm glad I asked.  That answer is quite surprising, and somewhat
> disconcerting.  Lot's of special cases going on here, which is bad.

Well, I think I agree with the principle of limiting the expressions
to dotted names. Some of the possibilities if you allow arbitrary
expressions are pretty hairy:

"""
Things someone might want to do, ordered roughly from most reasonable
to least reasonable ;)
@foo().bar()
@foo or bar
@mydecorators['foo']
@lambda f: foo(f) or bar(f)
"""
(from http://mail.python.org/pipermail/python-dev/2004-August/046673.html)



More information about the Python-list mailing list