[Python-ideas] Updating PEP 315: do-while loops
spir
denis.spir at free.fr
Sun Apr 26 14:46:07 CEST 2009
Le Sat, 25 Apr 2009 22:06:14 -0700,
Josiah Carlson <josiah.carlson at gmail.com> s'exprima ainsi:
> Condition at the bottom sucks for similar reasons as why ...
> def foo(...):
> (many lines of code)
> foo = classmethod(foo)
>
> Having your condition, modification, etc., at the end is just plain
> annoying. I like my conditions up top.
You're wrong:
> def foo(...):
> (many lines of code)
> foo = classmethod(foo)
is a bad syntax only because nothing tells you that, to understand foo's meaning properly, you need first to take something into account that is written after its def.
Where as in the following
do:
<suite>
until <condition>
(or any footer variant) the header "do:" warns you about the loop's logic: loop at least once, then check for an exit condition -- logically written at the loop's exit point ;-)
If the real issue you have in mind is that the loop's body may not fit inside the editor window, well...
Denis
------
la vita e estrany
More information about the Python-ideas
mailing list