(test) ? a:b

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Oct 22 13:41:49 CEST 2014

On 22/10/2014 10:27, Chris Angelico wrote:
> On Wed, Oct 22, 2014 at 8:16 PM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
>>> 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.
> No no no. Code like that doesn't deserve death, just community
> service. I've seen much MUCH worse... where multiple conditional
> expressions get combined arithmetically, and then the result used
> somewhere... I also may have been guilty of same, myself, though I'm
> going to plead the internet's equivalent of the Fifth Amendment to the
> US Constitution and not incriminate myself by showing the code...
> ChrisA

Perhaps you're correct.  Is there anything worse than looking at a 
dreadful piece of code that makes no sense at all and knowing that you'd 
written it six months earlier?

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