Lambda alternative?

Hrvoje Niksic hniksic at
Thu Apr 16 13:33:29 CEST 2009

mousemeat <mousemeat at> writes:

> Correct me if i am wrong, but i can pickle an object that contains a
> bound method (it's own bound method).

No, you can't:

>>> import cPickle as p
>>> p.dumps([])
>>> p.dumps([].append)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: expected string or Unicode object, NoneType found
> (I don't mean to be argumentative, i'm trying to understand python's
> syntax a little better.)

Note that this has nothing to do with syntax, but with the
(intentional) limitations of the "pickle" module.

More information about the Python-list mailing list