[Python-Dev] Wishlist: dowhile

Dmitry Dvoinikov dmitry at targeted.org
Mon Jun 13 12:43:36 CEST 2005


>> do:
>>     <body>
>>     until <cond>

> That looks nice to me.

Except this puts loop entry statement (do) and loop condition
test (until) on different levels of indentation, which is
I don't quite like.

Compared to the existing loop statements,

-------------------
while Cond:
    body
else:
    exit
-------------------
for Iter:
    body
else:
    exit
-------------------

This would seem more logical:

-------------------
do:
    body
while Cond:
else:
    exit
-------------------
do:
    body
until Cond:
else:
    exit
-------------------

Although the trailing colon is still a bit unpleasant:

-------------------

do:
    body
while Cond:

# no else here

-------------------

Sincerely,
Dmitry Dvoinikov
http://www.targeted.org/

--- Original message follows ---

> [BJörn Lindqvist] 
>> I would like to have do-while's like this:
>> 
>> do:
>>     <body>
>>     until <cond>
>> 
>> But I'm sure that has problems too.

> That looks nice to me.



> Raymond
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/dmitry%40targeted.org



More information about the Python-Dev mailing list