Nothing to do with style. It was the screaming inefficiency of:
if non_trivial_condition: return x
if not non_trivial_condition: return y
that fired me up.
"Screaming inefficiency"?
Try "micro-optimization". The difference in execution time between "if
x... if not x..." versus "if x... else..." on my slow, underpowered
machine is about 10**-8 seconds. If that's your idea of "screaming
inefficiency" I can't understand why you're programming in Python in the
first place.
Of course, if x is an expensive function call (say, a network lookup or
database query rather than a relatively cheap list indexing operation)
then the more readable, Pythonic solution will also be significantly
faster. There's no doubt that it should be preferred -- I'm not defending
it, as such, just pointing out the over-reaction of dismissing what is a
generally well-written and thought-out article on the basis of a
triviality.
Quoted Wikipedia -> instant disqualification -> you lose. Good night.
Oh gosh, well, you've certainly proven your case, how could I be so
stupid? My apology for thinking that you were acting like an arrogant,
bad-tempered dick. I don't know *what* I was thinking.