Concrete Proposal: while ... and while ...

Corran Webster cwebster at math.tamu.edu
Tue May 18 20:05:20 EDT 1999


Last night, after reading the latest assignment in expressions thread, I
went and hacked together a patch which implements the proposed

while:
  ...
and while test:
  ...

form of the while loop.  The "while 1" idiom is about the only thing which
irks me about the language, and it's something I'd like to see changed.
Compared to how smooth the rest of the language is, it sticks out like a 
sore thumb.  I'd prefer to see it spelt "do: ... while test: ..." but
understand the reluctance to add new keywords.

The patch is available at:

  http://www.math.tamu.edu/~cwebster/Python/andwhile-0.10.tar.gz

the readme file is available at

  http://www.math.tamu.edu/~cwebster/Python/andwhile.README

This patches against 1.5.2, and is implemented so it doesn't break
existing code.  It's also fairly conservative in that it only allows
one test in the loop, for reasons explained in the README.

If reaction is favourable, I'll submit it to Guido for potential inclusion
in Python 1.6.

hoping-for-an-end-to-assignment-in-expression-threads-ly y'rs,
Corran





More information about the Python-list mailing list