אלעזר wrote:
@partial(partial, partial(partial, partial)) def add(a, b, c): return a + b + c


For large numbers of arguments, it's much clearer if you
write it this way:

>>> from functools import partial as badger, partial as mushroom
>>> @badger(badger, badger(badger, badger(badger, mushroom)))
... def add(a,b,c,d):
...  return a+b+c+d
...
>>> add(1)(2)(3)(4)
10

--
Greg
_______________________________________________
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