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

Emanuel Barry vgr255 at live.ca
Mon Oct 26 09:57:01 EDT 2015


> From: ian.g.kelly at gmail.com
> Date: Sun, 25 Oct 2015 23:58:09 -0600
> To: python-ideas at python.org
> Subject: Re: [Python-ideas] "else if" as equivalent for "elif"
> 
> 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.

I agree it might sound a bit inconsistent that I take into account the space following 'for' but not the one following 'elif' - my point is that a human reader can easily look at the first characters before the next indentation level kicks in. This might not be a good example though now that I think of it, as a human reader would see that the line is not just 'else' (which was pretty much my original point). I recognize that you're right though, and I take back my words.
Cheers,-Emanuel Barry 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151026/333c48d4/attachment-0001.html>


More information about the Python-ideas mailing list