class Foo(object):
    b = 1

def factory(self, a):

    def _square(x):
        return a * x ** 2 + self.b
return _square
f = Foo()
f.b = 100
g = f.factory(-1)
p.map(g, list(range(10)))
Parallel Processing in python