Skip to content

Instantly share code, notes, and snippets.

@elleryq
Created October 18, 2013 07:27
Show Gist options
  • Save elleryq/7037738 to your computer and use it in GitHub Desktop.
Save elleryq/7037738 to your computer and use it in GitHub Desktop.
# Python functools.partial example.
from functools import partial
def foo(a, b, c, d):
return a+b+c+d
f1 = partial(foo, 1, 2)
print(f1(3, 4))
f2 = partial(foo, 1, 2, 3)
print(f2(5))
# Result
# 10
# 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment