'foot' controlled loop in python ??

Gerhard Häring gerhard.haering at opus-gmbh.net
Mon Dec 2 08:12:53 EST 2002


Axel Kowald <kowald at molgen.mpg.de> wrote:

> Hi,
> I got recently into Python and I like it a lot. However, I haven't found 
> a loop contruct that is 'foot' controlled, i.e. something like 'do 
> until' or 'repeat while'. Am I overlooking something or is there no such 
> thing ?

There is none. A possible workaround:

while 1:
    # loop body

    if ...:
        break

> And if not maybe that could be a suggestion for Python 2.3 ??

It's been discussed a few times in the past. See
http://groups.google.de/groups?hl=de&lr=&ie=UTF-8&oe=UTF-8&q=python+do+until

There's probably also no clean syntax that's consistent with the rest of
Python.
-- 
Gerhard Häring
OPUS GmbH München
Tel.: +49 89 - 889 49 7 - 32
http://www.opus-gmbh.net/



More information about the Python-list mailing list