replacing `else` with `then` in `for` and `try`
Steve D'Aprano
steve+python at pearwood.info
Fri Nov 3 21:09:21 EDT 2017
On Sat, 4 Nov 2017 06:15 am, Michael Torrie wrote:
> In fact if you have no break you may as well drop the
> else entirely, because the block will always execute.
That's incorrect. There are multiple ways to exit a loop that will prevent the
`else` block from executing, `break` is only one.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
More information about the Python-list
mailing list