#!/usr/local/bin/python2 from functools import partial def a(x): return x + 2 p = partial(reduce, lambda x, y: y(x), (a, a)) p.keywords[1] = a p(4)