When you pickle a function, you get a reference to the function, not the actual function code.
Right - that's usually what I want. (I've used pickle to store tests against game assets, e.g. that a model has all of its textures checked into perforce, or that a texture for a model does not exceed 128x128, unless otherwise specified). Marshalling functions is usually a non-starter for this, since a) it's complicated to analyse the call graph before execution, and b) native functions can't be marshalled - an awful lot of code executed against this asset pipeline is thin bindings over native/Java/C# code. Maybe I have found the 1% of the Python use-cases where lambdas suck a bit and everywhere else it's fine--it would be great if my experience was exceptional and no-one else had ever had a similar problem doing something else.
Re:Go is boring
by icebraining on Friday July 27, 2012 @01:20PM
(#4302474)
Oh, ok. I don't know how Python could pickle a reference to an anonymous function, 'though.
E.g., this doesn't work:
This throws What you can do is marshal the function's code: But you can also dump a lambda's code: So frankly, I don't get the problem with lambdas.