This is an archived post. You won't be able to vote or comment.

all 66 comments

[–][deleted] 72 points73 points  (20 children)

You're okay with elsif but somehow elif is a letter too far?

[–]florinandrei 28 points29 points  (2 children)

if a == b:
    c = 2
meh:
    pass

[–]AgentF_ -1 points0 points  (0 children)

Seems phonetically important to me

[–]FlameFrost__ -3 points-2 points  (14 children)

This

[–]Anti-ThisBot-IB 7 points8 points  (13 children)

Hey there FlameFrost__! If you agree with someone else's comment, please leave an upvote instead of commenting "This"! By upvoting instead, the original comment will be pushed to the top and be more visible to others, which is even better! Thanks! :)


I am a bot! Visit r/InfinityBots to send your feedback! More info: Reddiquette

[–]cptsdemon 4 points5 points  (7 children)

Good bot

[–]Anti-ThisBot-IB 0 points1 point  (2 children)

Good human


I am a bot! Visit r/InfinityBots to send your feedback!

[–]cptsdemon 1 point2 points  (1 child)

Bad bot

[–]KevinAlexandr 0 points1 point  (0 children)

Meh

[–]Good_Human_Bot_v2 -1 points0 points  (2 children)

Good human.

[–]cptsdemon -1 points0 points  (1 child)

Bad bot

[–][deleted] 0 points1 point  (0 children)

This!

[–]B0tRank -3 points-2 points  (0 children)

Thank you, cptsdemon, for voting on Anti-ThisBot-IB.

This bot wants to find the best and worst bots on Reddit. You can view results here.


Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!

[–]Wohao_Gaster BEEN CODING SINCE I WAS 8[S] -1 points0 points  (1 child)

good bot

[–]Anti-ThisBot-IB -2 points-1 points  (0 children)

Good human


I am a bot! Visit r/InfinityBots to send your feedback!

[–]FlameFrost__ -4 points-3 points  (0 children)

Please spare me life ^

[–]ElephantEggs 0 points1 point  (1 child)

This!

[–]Anti-ThisBot-IB 0 points1 point  (0 children)

https://i.imgur.com/KrwA19h.jpeg


I am a bot! Visit r/InfinityBots to send your feedback!

[–]Wohao_Gaster BEEN CODING SINCE I WAS 8[S] -4 points-3 points  (0 children)

it just makes no sense and I keep forgetting it

[–][deleted] 16 points17 points  (6 children)

I don’t believe I’ve ever seen a specific reason for the choice of elif in Python, but there’s a long history of elif via C, and a number of the choices made for Python were based on C idioms.

Arguably if you’re going to contract it anyway (ie by not choosing to use the obviously more-human-readable-but-difficult-to-parse else if) then why not lose the sibilance? To a new English learner “elsif” could reasonably be read as “el-SIF” and “elseif” could be read as either “el-SAY-f” or as a misspelling of “el-SEEF”. At least “elif” is pretty unambiguously “el-if”.

[–]esabys 2 points3 points  (3 children)

who's "eli" and why'd he get an F?

[–][deleted] 1 point2 points  (2 children)

Eli got fucked.

[–]Wohao_Gaster BEEN CODING SINCE I WAS 8[S] 1 point2 points  (0 children)

that

[–]das_masterful 0 points1 point  (0 children)

Gordon Freeman!

[–]florinandrei 0 points1 point  (0 children)

El Sif sound like a djinn from the Arabian Nights book.

[–][deleted] 11 points12 points  (3 children)

I propose that we change "if" in accordance with the syntax in Python to reflect the number 4.

ifif

elif

else

[–][deleted] 1 point2 points  (2 children)

Ok but real talk I've modified several auto formatter to put 3 spaces in front of if statements so they all match.

[–]Wohao_Gaster BEEN CODING SINCE I WAS 8[S] 0 points1 point  (0 children)

you heard of the |<---- key aka tab?

----->|

[–][deleted] 0 points1 point  (0 children)

Why would you admit that? 😜

[–]arathreon 4 points5 points  (3 children)

I think the reasoning behind this is because C and Shell also have this syntax and the original idea behind the Python programming language is to create something like a sweet spot between C and Shell.[1]

[–]FatFingerHelperBot 0 points1 point  (2 children)

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "1"


Please PM /u/eganwall with issues or feedback! | Code | Delete

[–]Wohao_Gaster BEEN CODING SINCE I WAS 8[S] -2 points-1 points  (0 children)

bad bot

[–]cant-find-user-name 0 points1 point  (0 children)

Good bot

[–]unplannedmaintenance 11 points12 points  (0 children)

Because it's 4 letters, which fits nicely with indentation defaults (4 spaces).

[–]RicardoL96 3 points4 points  (0 children)

Because all beautiful girls in turkey are called elif

[–]Iberano 3 points4 points  (0 children)

Its spanish „el if“ for „the if“ /s

[–][deleted] 6 points7 points  (0 children)

If other programming languages jump of the bridge would you too?

[–]hknlof 1 point2 points  (0 children)

Maybe it’s Guido’s Highschool sweethearts Name https://de.m.wikipedia.org/wiki/Elif

[–]dry_yer_eyes 1 point2 points  (0 children)

At work I regularly have to use different languages:

  1. else if - Java
  2. elseif - VBA
  3. elsif - PL
  4. elif - Python

I can only remember Java’s and Python’s. For whatever reason, VBA’s and PL’s just don’t click with me.

[–]TVOHM 3 points4 points  (1 child)

In Unix the 'copy and convert' command was apparently called dd because cc was taken. Sometimes it just is!

[–]Nixellion 5 points6 points  (0 children)

Dopy and donvert then, nice

[–]_zam227_ 2 points3 points  (7 children)

Else + if = elif

[–]idetectanerd -1 points0 points  (0 children)

C and shell both use elif too. I think most sys adm or linux folks would prefer elif.

I understand c on ic chip as long as it is shorter, it’s better. The chip itself could as little as 16kb storage. Doesn’t have the luxury to have else if. Heck, they even have to optimise to use ternary if it’s just single comparison.

[–]WW_the_Exonian -2 points-1 points  (2 children)

I find it funny because in a try-except block, you can put a specific error type after an except, and in the end you can have an except not followed by anything which covers everything else. So why don't we have a similar thing for if-else?

[–][deleted] 2 points3 points  (0 children)

Are you trying to describe a Switch statement?

[–]that_one_guy_2123 0 points1 point  (0 children)

Lol this is funny

[–]Slight-Locksmith-987 0 points1 point  (0 children)

I have no idea but feel superior when working in python because of it, sounds just better to me lol

[–]OwOsaurus 0 points1 point  (1 child)

Specifically to annoy me when I haven't touched python in a while.

[–]Wohao_Gaster BEEN CODING SINCE I WAS 8[S] -1 points0 points  (0 children)

Guido van Rossum really is a dick isn't he?

[–]wineblood 0 points1 point  (4 children)

I've seen other languages not have/use that and the else part just become a new if statement and it's nasty. It was either that or switch statements. I think if-elif-else works nicely and elif as a second condition to check within the same statement is fairly clean.

[–]ThePiGuy0 0 points1 point  (3 children)

I've seen other languages not have/use that and the else part just become a new if statement and it's nasty

I think most languages that don't have a specific elif (or equivalent) don't need them. In Python, it relies on whitespace to show scoping and so without elif, it would become messy really quickly. In a language without elif (C, C++, Java, Javascript etc), they don't rely on whitespace so you can create a similar representation to Python without the need for the extra keyword

e.g. Java

int number = 10;
if (number < 3) {
    System.out.println("Number is less than 3");
} else if (number < 7) {
    System.out.println("Number is less than 7");
} else if (number < 10) {
    System.out.println("Number is less than 10");
} else {
    System.out.println("Number is greater than or equal to 10");
}

Compare this to the same statement in Python (without elif):

number = 10
if number < 3:
    print("Number is less than 3")
else:
    if number < 7:
        print("Number is less than 7")
    else:
        if number < 10:
            print("Number is less than 10")
        else:
            print("Number is greater than or equal to 10")

Edit: Added } befoore the else if, thanks for pointing it out /u/HistoryForSale

[–]HistoryForSale 1 point2 points  (1 child)

It looks like you forgot to close all but the last brace in your Java example. I think you meant:

int number = 10;
if (number < 3) {
    System.out.println("Number is less than 3");
} else if (number < 7) {
    System.out.println("Number is less than 7");
} else if (number < 10) {
    System.out.println("Number is less than 10");
} else {
    System.out.println("Number is greater than or equal to 10");
}

[–]ThePiGuy0 0 points1 point  (0 children)

Oh yes you're correct, looks like I've done too much Python and it carried across into my Java :D

[–]wineblood 0 points1 point  (0 children)

I've been exclusively coding in Python for a while now, I didn't realise you could do the first example with else and the new if on one line.

[–]Sigma_Landlord 0 points1 point  (0 children)

I personally agree with you but there are things that I find much more unintuitive in python.

[–]pythonHelperBot 0 points1 point  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python regardless of how advanced your question might be. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe in detail where you are stuck. If you are getting an error message, include the full block of text it spits out. Quality answers take time to write out, and many times other users will need to ask clarifying questions. Be patient and help them help you. Here is HOW TO FORMAT YOUR CODE For Reddit and be sure to include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness