Paul Rubin <http://phr...@nospam.invalid> wrote:
> Duncan Booth <duncan.bo...@invalid.invalid> writes: >> What exactly is your objection to using a named function here?... >> Surely that would solve your pickle problem *and* give you more >> meaningful tracebacks in your exceptions? > > I don't think it would help the pickle problem. Why wouldn't you think that? class material(object): def __init__(self,density): self.density=density def airdensity(T): return 100000/(287*T) air=material(airdensity) steeldensity=lambda T:interp(T,[0,1000],[7856,7813]) steel=material(steeldensity) from pickle import dumps, loads dumped = dumps(air) t = loads(dumped) print t # works fine dumped = dumps(steel) # pickle.PicklingError: Can't pickle <function # <lambda> at 0x0000000002C78A58>: it's not found as __main__.<lambda> -- http://mail.python.org/mailman/listinfo/python-list