Created
September 15, 2014 17:58
-
-
Save nahuel/6e821c93a8f829b3db01 to your computer and use it in GitHub Desktop.
functools.partial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
class A: | |
def __init__(s): | |
s.a = 1 | |
def c(s,b,c,d): | |
print s.a,b,c,d | |
a = A() | |
a.c(2,3,4) | |
#=> 1 2 3 4 | |
f = functools.partial(a.c, 2) | |
f(3,4) | |
#=> 1 2 3 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment