On Tue, Sep 20, 2016 at 9:18 PM Stephan Houben <stephan...@gmail.com> wrote:

> I must admit I am a bit partial to partial, you can do fun things like
> this:
>
> >>> from functools import partial
> >>> @partial(partial, partial)
> ... def add(x, y):
> ...     return x+y
> ...
> >>> add(3)(4)
> 7
>
> I suppose that isn't exactly going to convince Guide to put it in
> builtins, though.
>
> I quietly LOLed, but note that for three arguments you'll need

@partial(partial, partial(partial, partial))
def add(a, b, c): return a + b + c

>>> add(1)(2)(3)
6

So @curry is the transitive closure or something :)

Elazar
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to