[Python-Dev] Decorators with arguments are curries! (original) (raw)
Nick Coghlan ncoghlan at iinet.net.au
Wed Aug 11 07:47:20 CEST 2004
- Previous message: [Python-Dev] Decorators with arguments are curries!
- Next message: [Python-Dev] Decorators with arguments are curries!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Phillip J. Eby wrote:
At 10:36 PM 8/7/04 +1000, Andrew Durdin wrote:
def bardecorator(func, param): print param return func Decorator syntax does not provide currying. You have to write something like this: Or, if the 'partial' function is in the standard lib by that point, you can use it to get your decorator. . .
X>>> @partial(bar_decorator(param_val)) X... def myFoo(): pass
Cheers, Nick.
(P.S. Does the interactive interpreter currently do a line continuation after the decorator line?)
-- Nick Coghlan | Eugene, Oregon Email: ncoghlan at email.com | USA
- Previous message: [Python-Dev] Decorators with arguments are curries!
- Next message: [Python-Dev] Decorators with arguments are curries!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]