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

2005-01-03 Thread TZOTZIOY
On Thu, 23 Dec 2004 19:57:27 GMT, rumours say that rzed <[EMAIL PROTECTED]> might have written: [Why did PEP 275 stall?] >It seems to me that it was regarded as misguidod. QOTPE +1 (PE=Python Era) Oncoming Python book: "Hitchhiker's Guido to the Python Language" -- TZOTZIOY, I speak England v

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 >

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