How coding in Python is bad for you

Erik python at lucidity.plus.com
Sun Jan 29 18:52:33 EST 2017


On 29/01/17 14:42, Steve D'Aprano wrote:
> 1. for...else is misspelled, and should be for...then;
>
> 2. Same for while...else;

I don't think I'll ever agree with you on this one.

"then", to me, implies the code following it is always executed.
"else" implies it's conditional.

In those constructs it's conditional and therefore, to me, "else" is a 
better reminder of that.

It would be even better if it was "else if not break:" to make the 
meaning clearer. I would agree that it would be even better than that if 
it was "then if not break:" (apart from needing the new keyword ;)), as 
then the conditional aspect is explicit.

E.


More information about the Python-list mailing list