Lambda alternative?

Caleb Hattingh caleb.hattingh.no.spam at nospam.gmail.com
Wed Apr 15 16:58:28 EDT 2009


On Wed, 15 Apr 2009 15:47:05 +0200, <mousemeat at gmail.com> wrote:

> But, lambda functions can't be pickled. I would like to pickle my
> objects, and i would really like to use parallel python (which
> requires pickling).

If you are fixated on using lambda, you could probably use Recipe 7.6:  
Pickling Code Objects in the Python Cookbook, 2nd Edition, or here:

http://www.ubookcase.com/book/Oreilly/Python.Cookbook.2nd.edition/0596007973/pythoncook2-chp-7-sect-6.html

However, it is better to use named functions as all the other posters have  
already mentioned.



More information about the Python-list mailing list