[issue19272] Can't pickle lambda (while named functions are ok)

Ethan Furman report at bugs.python.org
Thu Oct 17 04:04:03 CEST 2013


Ethan Furman added the comment:

Jesús Cea Avión added the comment:
> 
> If at your "top level" (module) you do:
> 
> """
> a = lambda x: 2*x
> """
> 
> You don't have an anonymous function, but a function called "a".

Actually, you do have an anonymous function, which happens to be bound to the name "a".

Compare:

    --> def a():
    ...     pass
    --> a.__name__
    'a'

and 

    --> a = lambda: None
    --> a.__name__
    '<lambda>'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19272>
_______________________________________


More information about the Python-bugs-list mailing list