[Python-ideas] Syntax for curried functions
Weeble
clockworksaint at gmail.com
Mon Mar 2 20:07:14 CET 2009
Steven D'Aprano wrote:
> Weeble wrote:
> > Would this be crazy? Make this:
> >
> > def spam(a,b,c)(d,e,f):
> > [BODY]
> >
> > a synonym for:
> >
> > def spam(a,b,c):
> > def spam2(d,e,f):
> > [BODY]
> > return spam2
> >
> > As far as I can tell, it would always be illegal syntax right now, so
> > it seems a safe change. And it would make it cleaner to write higher
> > order functions.
>
> I don't think it would. Your proposed syntax is only useful in the case
> that the outer function has no doc string and there's no pre-processing
> or post-processing of the inner function, including decorators.
Fair enough. I knew I must be overlooking something.
Sturla Molden wrote:
> This is atrocious.
:'(
Sorry. I thought it might be a bit of a crazy idea. I didn't think it
was that bad!
More information about the Python-ideas
mailing list