[Python-ideas] Updating PEP 315: do-while loops

George Sakkis george.sakkis at gmail.com
Sun Apr 26 08:22:31 CEST 2009


On Sun, Apr 26, 2009 at 1:20 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Sun, 26 Apr 2009 03:06:14 pm Josiah Carlson wrote:
>> 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.
>
> But if the condition isn't tested until the bottom of the block, then
> putting it at the top is weird.

"Weird" is an understatement; I'd rather say outright misleading.
There's nothing in "do ... while cond" that even hints that the
condition is not checked the first time.

George



More information about the Python-ideas mailing list