why no "do : until"?

henry_crun3583 at my-deja.com henry_crun3583 at my-deja.com
Sun Dec 31 16:12:52 EST 2000


I can't really see a problem with any of the suggested indents.

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

Is neater but I don't have any trouble reading (b)

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

if thats what the parser likes. But why can't the parser ingnore extra
indents, in the same way C,Pascal ignore blocks added purely for
clarity? If you want some extra indent, add it.

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

Tim Peters raises the question of do: while vs do: until

Personally I think "do: until" more often reflects the algorithm I am
representing, however "do: while" leads to a single consistent test for
both ("while:" & "do:while") loops, and can reduce bugs, especially
when you decide to change a loop from one to the other and forget to
fix the terminate condition. (I am a VERY vague programmer)



Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list