Lambda alternative?
Duncan Booth
duncan.booth at invalid.invalid
Wed Apr 15 11:16:43 EDT 2009
mousemeat at gmail.com wrote:
> class material(object):
> def __init__(self,density):
> self.density=density
>
> airdensity=lambda T:100000/(287*T)
> air=material(airdensity)
What exactly is your objection to using a named function here?
def airdensity(T):
return 100000/(287*T)
air=material(airdensity)
Surely that would solve your pickle problem *and* give you more meaningful
tracebacks in your exceptions?
--
Duncan Booth http://kupuguy.blogspot.com
More information about the Python-list
mailing list