Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is functools.partial:

  from functools import partial
  def add(x,y): return x+y
  add3 = partial(add, 3)
  add3(2) # returns 5


Ah! I didn't know about that. It'd be nice to have the syntactic sugar à la Haskell, but oh well. Close enough.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: