Conditional Expressions don't solve the problem

Christopher A. Craig com-nospam at ccraig.org
Wed Oct 17 08:36:05 EDT 2001


salemail at dial.pipex.com (Kevin D) writes:

> So, to fix those problems a solution must:
> 
> 1) Allow the loop's "load" code to exist just once, preferably
> somewhere near the terminating condition.
> 2) Have the terminating condition near the "while", and of the right
> "polarity".
> 3) To be Pythonic, have an obvious meaning.
> 

I personnally don't like your suggestion as they are mind numbingly ugly and
remind me of the Algol 60 loops.  I wish Python had initially adopted

  do:
    <statements>
    until <condition>
    <statements>

Which is, of course, behaves identically to

  while 1:
    <statements>
    if <condition>: break
    <statements>

but is prettier.  But I don't see the increased readability being sufficient
to warrant the change.  Additionally I think that the present system is not
that hard to adapt to.

-- 
Christopher A. Craig <com-nospam at ccraig.org>




More information about the Python-list mailing list