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

Chris Angelico rosuav at gmail.com
Sun Oct 25 21:02:22 EDT 2015


On Sat, Oct 24, 2015 at 7:39 PM, Sven R. Kunze <srkunze at mail.de> wrote:
> 1) I may re-iterate. Such thinking is dangerous. It could mean standstill.
> It prevents thinking and progress. That is python-ideas; not
> python-controlling.

The point of discussing ideas is to sort out the good ones from the
bad ones. One of the most effective ways to do this is to have someone
advocate an idea, and someone else criticize it, with the resulting
discussion being (hopefully!) a fruitful analysis of the idea's
qualities. So while you're correct that this is called "python-ideas"
for a reason, Nick is also absolutely correct in criticizing the idea.
A good idea will be able to stand up to critics.

> 2) Is Python not an open-source project? Could not anybody contribute? To me
> that means, the sky is the limit.

"Open source" and "free software" and so on do not mean that anyone
can make changes to the core. It does mean, however, that you're
legally, morally, and ethically permitted to make your own version of
CPython that includes the "else if" notation, play around with it, and
demonstrate your idea in action. This is actually a great way to
support an idea; you can find out exactly how much code would have to
change to make this work, and start playing around with it. And then
if the idea does end up being accepted, your patch can be incorporated
into the main body of code.

> 3) Well, that the features you mentioned really do what they promise can be
> only be proved if they are implemented and used. So, we will see how they
> fare. Same, btw., would be for "else if". All of your and mine great
> thoughts are just that: thoughts, assumptions, arguments. Not facts.
>

Yep. And that's why it helps to spin up a patch. Unfortunately this is
a change to the language grammar, which is not the easiest thing to
tweak (if you were proposing a change to a pure Python module in the
standard library, you could play with it much more easily); but if you
write the patch yourself, you are directly answering (part of) Nick's
objection about opportunity cost.

Personally, I'm not in favour of adding another way of spelling elif.
If every other language in the world spelled it "else if" and Python
alone used "elif", then I'd support adding the alias, for the
convenience of people working with multiple languages; but it's not
that consistent (some languages use "elsif", "elseif", and various
other forms). The readability argument is weak, and I don't see any
reason to create two distinct ways of spelling the exact same thing.
But hey! Play with the patch, have some fun with it.

ChrisA


More information about the Python-ideas mailing list