currying at language level (was: Re: add_command)
holger krekel
pyth at devel.trillke.net
Mon May 13 04:49:55 EDT 2002
Alex Martelli wrote:
> You can also curry in Python 1.5.2 should you need to -- it's just
> a _little_ bit clunkier perhaps:
>
> def curry(func, *args, **kwds):
> def curried(f=func, a=args, k=kwds):
> return apply(f, a, k)
> return curried
Alex, what do you think about integrating the
currying-concept into python's syntax like so:
def normalfunc(arg1,arg2,arg3): pass
curryfunc = normalfunc(arg1, *, arg3)
and curryfunc would be a one-argument function [1].
I'm sure you can explain to me in concise
words why this is the wrong thing (tm) :-)
IMHO currying is a well-understood concept
which would serve well at the language level.
regards,
holger
[1] the '*' should and can be recognized by the parser
to avoid *any* performance decreases for
normal function calls. One may allow
or enforce '***' to make it more visible.
More information about the Python-list
mailing list