replacing `else` with `then` in `for` and `try`

Jon Ribbens jon+usenet at unequivocal.eu
Thu Nov 2 09:39:37 EDT 2017


On 2017-11-01, Alexey Muranov <alexey.muranov at gmail.com> wrote:
> what do you think about the idea of replacing "`else`" with "`then`" in 
> the contexts of `for` and `try`?
>
> It seems clear that it should be rather "then" than "else."  Compare 
> also "try ... then ... finally" with "try ... else ... finally".
>
> Currently, with "else", it is almost impossible to guess the meaning 
> without looking into the documentation.

Why would we want to make the language worse? It is fairly obvious
what 'else' means, whereas 'then' has an obvious meaning that is in
fact the opposite of what it would actually do. It seems clear that
'else' is the correct word (or at least, far better than 'then').

Maybe the change should be that it is a syntax error to use a
'for/while...else' with no 'break'.



More information about the Python-list mailing list