Is there something similar to ?: operator (C/C++) in Python?

Scott David Daniels Scott.Daniels at Acm.Org
Wed Jun 29 03:07:16 CEST 2005


Ron Adam wrote:
> Mike Meyer wrote:
> 
>> Riccardo Galli <riccardo_cut1 at cut2_sideralis.net> writes:
>>> result = [value2,value1][cond]
Or:
     result = [(lambda: expr0), lambda: expr1][cond]()

Which is harder to understand than the if-based assignment even
with 5-character expressions.


--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list