[Python-ideas] Syntax for defining parametric decorators

Antoine Pitrou solipsis at pitrou.net
Sun Jul 8 23:52:46 CEST 2012


On Sun, 8 Jul 2012 16:22:43 -0400
Mike Graham <mikegraham at gmail.com> wrote:
> 
> which confuses many users and can be a handful to type. I wonder if it
> would be clearer for people to write
> 
> def timesn(n)(f):
>     def inner(y):
>         return n * f(y)
>     return inner

But then, why not:

def timesn(n)(f)(y):
    return n * f(y)

?

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net





More information about the Python-ideas mailing list