Home Tags About

Python: functools.partial usage

30 Aug 2012
python functools

Code:

#!python
import functools

def add(a, b):
    return a + b

plus3 = functools.partial(add, 3)

plus3(1)
# out: 4

plus3(7)
# out: 10