Friday Finking: Contorted loops
Joe Pfeiffer
pfeiffer at cs.nmsu.edu
Fri Sep 10 17:08:19 EDT 2021
ram at zedat.fu-berlin.de (Stefan Ram) writes:
> ram at zedat.fu-berlin.de (Stefan Ram) writes:
>>can be misleading, because the "..." part can still contain
>>"break", "raise", "continue", and "return" statement. So one
>>better should always be on the watch when reading source code
>>of a language like Python than relying only on the condition
>>behind the "while".
>
> The existence of statements like "break" renders
> proof techniques for loops (such as Hoare's) with
> their invariants and inference rules unapplicable.
Also the reason to avoid repeat-until loops: the loop "invariant" isn't
the same on the first iteration as on subsequent iterations.
More information about the Python-list
mailing list