Conditional Expressions don't solve the problem
D.M.Pick at qmw.ac.uk
Tue Oct 30 15:15:18 CET 2001
Christopher A. Craig (com-nospam at ccraig.org) wrote:
: 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
: until <condition>
: Which is, of course, behaves identically to
: while 1:
: if <condition>: break
: 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.
And even prettier is:
with the indentation highlighting the places where an "exit" from the loop
can happen under control.
More information about the Python-list