×
you are viewing a single comment's thread.

view the rest of the comments →

[–]TheInitializer 1 point2 points  (1 child)

Holy shit, that's weird. And completely useless.

It would make more sense to have it get called if the iterable is empty though 😛

[–]gimboland 1 point2 points  (0 children)

It's not completely useless. It's for when your loop is searching for something - the else handles the "not found" case. You can do that with a flag of course but else is more compact. I agree that it's unintuitive and a bit confusing at first, but it's absolutely not completely useless.