Switch statement (was: Lambda going out of fashion)

2004-12-23 Thread Skip Montanaro
Stephen { Stephen 'one': lambda x:x.blat(), Stephen 'two': lambda x:x.blah(), Stephen }.get(someValue, lambda x:0)(someOtherValue) One thing to remember is that function calls in Python are pretty damn expensive. If x.blat() or x.blah() are themselves only one or two lines of

Re: Switch statement (was: Lambda going out of fashion)

2004-12-23 Thread rzed
Skip Montanaro [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Stephen { Stephen 'one': lambda x:x.blat(), Stephen 'two': lambda x:x.blah(), Stephen }.get(someValue, lambda x:0)(someOtherValue) One thing to remember is that function calls in Python are pretty damn