4 ms·
There is functools.partial: from functools import partial def add(x,y): return x+y add3 = partial(add, 3) add3(2) # returns 5
by Lycanthrope 15y ago
There is functools.partial:
from functools import partial
def add(x,y): return x+y
add3 = partial(add, 3)
add3(2) # returns 5
- skimbrel 15y agoAh! I didn't know about that. It'd be nice to have the syntactic sugar à la Haskell, but oh well. Close enough.