replacing `else` with `then` in `for` and `try`

Michael Torrie torriem at gmail.com
Fri Nov 3 22:57:11 EDT 2017


On 11/03/2017 07:09 PM, Steve D'Aprano wrote:
> 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.

Such as?



More information about the Python-list mailing list