Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 2
    "The break jumps out of the block, and so jumps 'over' the else clause" - while this may be helpful as a way of "getting" for:/else:, it doesn't really provide a justification for the keyword being else. Given the framing given here, then: seems like it would be much more natural. (There are reasons for else being chosen, given in other answers - they're just not provided here.) Commented Feb 16, 2018 at 12:10
  • @Neil_UK "if iterable_supplies_a_value:" sounds like "else:" runs only when the iterable was empty, which is a common wrong guess of what it does. But previous parts of your answer explain it correctly. As written, it's unclear what you meant by "That also reinforces this interpretation" Commented Oct 19, 2023 at 8:30