This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jcea
Recipients amaury.forgeotdarc, ethan.furman, facundobatista, jcea, r.david.murray
Date 2013-10-16.22:00:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381960839.97.0.190649260127.issue19272@psf.upfronthosting.co.za>
In-reply-to
Content
Lambdas are "anonymous" functions, by definition. And, usually, they are not top level functions, but defined inside others.

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". You can argue why "def a() : return 2*x" can be picked, but "a = lambda x: 2*x" can not. They look similar.

What the poster actually wanted (tell me if I am wrong), I guess, is to be able to serialize the function code and send it to other process to be executed there. Something like "mobile" code. As is, pickle doesn't allow it (that is the reason I was brainstorming about being able to pickle "function.__code__" objects), and it is good because pickle guarantees compatibilities between Python versions, but "__code__" objects are particular to a certain Python virtual machine and certain version of it.

That said, projects like PYRO provide "mobile code". I think that a recipe for that would be nice in the documentation, with a big warning saying "be sure you have the same implementation in both sides", and explicit versioning in the client and version checking in the server, in the recipe (to make it clear that same version is something you need).
History
Date User Action Args
2013-10-16 22:00:40jceasetrecipients: + jcea, facundobatista, amaury.forgeotdarc, r.david.murray, ethan.furman
2013-10-16 22:00:39jceasetmessageid: <1381960839.97.0.190649260127.issue19272@psf.upfronthosting.co.za>
2013-10-16 22:00:39jcealinkissue19272 messages
2013-10-16 22:00:39jceacreate