why no "do : until"?

Andrew Henshaw andrew_dot_henshaw_at_earthling_dot_net
Sat Dec 30 22:21:12 EST 2000


<henry_crun3583 at my-deja.com> wrote in message
news:92jj3j$ff7$1 at nnrp1.deja.com...
> Can someone point me at an explanation of the logic for not having
> do:
> until
>
> or explain the elegant way to achieve this in Python.
>
> eg
> do :
>     R=Themistor.ReadResistance()
>     T=R_to_Temperature(R)
>   until (T >=25)
>

No one else seems to have brought up this point, so I'll attempt it ...
1.  How do you suggest implementing the indentation rules?  You seem to have
left your indentation ambiguous.
a)
do:
    R=Themistor.ReadResistance()
    T=R_to_Temperature(R)
until (T>=25)

or
b)
do:
    R=Themistor.ReadResistance()
    T=R_to_Temperature(R)
    until (T>=25)

If a), then this looks very unPythonic, because the indentation blocking is
backwards.  In other words "until (T>=25)" is a control statement for an
indented block that is above it (and it doesn't have a ":")
.
I understand that Python has statements like
if blah:
    do_something()
else:
    do_something_else()

but the else: doesn't control the statement above it.

if you suggest syntax b), then I wouldn't be greatly opposed, I suppose.
But then "do:" would simply be a synonym for "while 1:" and "until" would be
a synonym for "if : break".








More information about the Python-list mailing list