(test) ? a:b

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Oct 22 05:16:07 EDT 2014


On 22/10/2014 10:05, buscacio at gmail.com wrote:
> Em quarta-feira, 22 de outubro de 2014 06h29min55s UTC-2, ast  escreveu:
>> Hello
>>
>>
>>
>> Is there in Python something like:
>>
>>
>>
>> j = (j >= 10) ? 3 : j+1;
>>
>>
>>
>> as in C language ?
>>
>>
>>
>> thx
>
> without not:
> j = [j+1, 3][j>=10]
> with not:
> j = [3, j+1][not (j>=10)]
>

The death penalty should be reintroduced into the UK for two crimes, 
writing code like the above and using google groups.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list