Using Pool map with a method of a class and a list

Joshua Landau joshua at landau.ws
Wed Aug 7 18:49:47 EDT 2013


On 7 August 2013 23:26, Luca Cerone <luca.cerone at gmail.com> wrote:
> Thanks for the post.
> I actually don't know exactly what can and can't be pickles..

I just try it and see what works ;).

The general idea is that if it is module-level it can be pickled and
if it is defined inside of something else it cannot. It depends
though.

> not what partialing a function means..

"partial" takes a function and returns it with arguments "filled in":

    from functools import partial

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

    add5 = partial(add, 5)

    print(add5(10)) # Returns 15 == 5 + 10

> Maybe can you link me to some resources?

http://docs.python.org/2/library/functools.html#functools.partial


> I still can't understand all the details in your code :)

Never mind that, though, as Peter Otten's code (with my very minor
suggested modifications) if by far the cleanest method of the two and
is arguably more correct too.



More information about the Python-list mailing list