20 Jul
2020
20 Jul
'20
2:36 a.m.
On 15/07/2020 09:20, Dominik Vilsmeier wrote:
But `finally` with a `for` loop is redundant since the code can be placed just after the loop. For `try/except` it's a different situation since the exception might bubble up, so "normal" code after the `try` won't be reached.
+1
Also `on_break` doesn't seem really important since that code can be executed inside the loop right before the `break`.
Not true, because you might have multiple breaks. This would avoid putting the same code after each one. May I repeat: Spelling 'if break:' and 'if not break:' rather than say 'on_break:' etc. would avoid adding new keywords. I don't know what to do about the zero iterations case, though. Best wishes Rob Cliffe