[Python-ideas] "else if" as equivalent for "elif"

Ian Kelly ian.g.kelly at gmail.com
Mon Oct 26 01:58:09 EDT 2015


On Sun, Oct 25, 2015 at 7:28 PM, Emanuel Barry <vgr255 at live.ca> wrote:
> Here is yet another argument against this change -- indentation. Indentation
> is, as we all well know, one of the core aspects of Python's syntax. In
> every project I have worked on, and in PEP 8 (
> https://www.python.org/dev/peps/pep-0008/#indentation ), 4-space indents are
> used. 'elif' is exactly 4 characters long, which means it lines up pretty
> well with other similar keywords such as 'else' or 'for' (with the space
> that follows it). In that regard, 'else if' would actually make code
> *harder* to read, not easier! In the same sense that 'def' (followed by a
> space) makes it very easy to spot the functions' names (if for some reason
> you don't have syntax highlighting ... ), 'elif' makes it easy to spot the
> beginning of another condition statement within a block.

I'm not following. Can you provide an example of how this hurts
indentation? It seems a stretch to suggest that "elif" lines up with
"for" because you're including the space that follows "for", but
you're excluding the space that follows "elif".

I note that "else if" has the same length as "finally", if that matters.


More information about the Python-ideas mailing list