(test) ? a:b

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Oct 22 07:45:03 EDT 2014


On 22/10/2014 10:14, ast wrote:
>
> <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

IMHO it's just dreadful.  Why people insist on messing around like this 
I really don't know, it just drives me nuts.

Also would you please access this list via 
https://mail.python.org/mailman/listinfo/python-list or read and action 
this https://wiki.python.org/moin/GoogleGroupsPython to prevent us 
seeing double line spacing and single line paragraphs, thanks.

-- 
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