(test) ? a:b

ast nomail at invalid.com
Wed Oct 22 11:14:20 CEST 2014


<buscacio at gmail.com> a écrit dans le message de 
news:7839376e-fc27-4299-ae63-4ddf17ef9a8a at googlegroups.com...
> 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)]
>

Oh it's a trick !
thx 




More information about the Python-list mailing list