generator expressions and new ternary operator

Steven Bethard steven.bethard at gmail.com
Mon Sep 13 02:50:04 EDT 2004


zipher <zondervanz <at> gmail.com> writes:
> 
> Mightn't this new latter syntax be the ticket to a "one obvious way"
> to write a ternary expression in python?
> 
> >>> (foo(i) if i==42 else bar(i))   # i==42 ? foo(i) : bar(i)
> 

I really shouldn't respond to this because the debate over a ternary operator 
already went on *way* too long...  But this proposal completely confuses me...

Why would we want something that isn't a generator expression to look anything 
like one?

Steve




More information about the Python-list mailing list