Lambda alternative?

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


mousemeat <mousemeat at gmail.com> 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([])
'(l.'
>>> 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