multiprocessing module - isn't it a bug?

Christian Heimes lists at
Sat Mar 14 19:59:12 CET 2009

dmitrey wrote:
> This doesn't work for
> costlyFunction2 = lambda x: 11
> as well; and it doesn't work for imap, apply_async as well (same
> error).
> So, isn't it a bug, or it can be somehow fixed?
> Thank you in advance, D.

It's not a bug but a limitation of the pickle protocol. Pickle can't
handle nested functions or classes. As a rule of thumb pickle can only
handle functions and classes that are accessible via a dotted name, e.g.
package.module.SomeClass.somefunction or anothermodule.afunction.


More information about the Python-list mailing list