do...until wisdom needed...

Benjamin.Altman benjamin.altman at noaa.gov
Mon Apr 16 13:22:36 EDT 2001


Ugliness aside, it would work since it is dependant on indentation.  In your example you
would have to do:
    while cond():
        #bla
        #bla
        #bla

            #do some stuff
        until cond2()

So the #do some stuff is done until cond2() is satisfied.  The until is inline with the
#bla code and the contents of the until are indented one level further.

Remco Gerlich wrote:

> Benjamin.Altman <benjamin.altman at noaa.gov> wrote in comp.lang.python:
> > Any answer does not seem ideal in Python, but what about an indent concluded with an
> > "until" like:
> >
> >         # do some stuff
> >         # do some more stuff
> >     until condition == true
>
> So how would you put that after another block?
>
> while cond():
>    #bla
>    #bla
>    #bla
>
>    #do some stuff
> until cond2()
>
> That doesn't work. You need a proper non-indented block start.
>
> Besides, it's ugly :).
>
> --
> Remco Gerlich




More information about the Python-list mailing list