Lambda alternative?

Hrvoje Niksic hniksic at xemacs.org
Fri Apr 17 16:46:10 EDT 2009


Duncan Booth <duncan.booth at invalid.invalid> writes:

>>>>> 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
>
> Not the best of examples: [].append is a built-in method rather than a 
> bound method.

Sorry about the confusion.  By bound method I meant the callable
obtained by binding a method (built-in or written in python) to a
concrete instance, as opposed to an unbound method, such as
list.append.  The reprs are different for built-in methods and for
python methods, but I consider that difference an artifact of the
CPython implementation, not a distinction mandated by the language.



More information about the Python-list mailing list