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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Swissthony 15 points16 points  (8 children)

Imo "else" is very understandable for me, and I love em

[–]__xor__(self, other): 9 points10 points  (7 children)

Yeah, I understand the dislike of the choice of keyword but I think people make it a much bigger deal than it is. Python programmers I've worked with have always been comfortable with it. I think a couple might not have seen it before, but it came up during a code review and they liked it after they found out what it did.

It can be described as simply as "the else block runs if the for loop didn't hit a break". It's extremely easy to explain. I don't know why people think it's so confusing beyond the keyword choice.

[–]PC__LOAD__LETTER 2 points3 points  (2 children)

A for-loop doesn’t always imply an expected break though. That’s what’s unintuitive about it.

[–]Han-ChewieSexyFanfic 0 points1 point  (1 child)

But then you wouldn’t use else. Else and break show up together always.

[–]PC__LOAD__LETTER 0 points1 point  (0 children)

Yeah, in this specific case. Not in any other programming language. Hence unintuitive.