while true: !!!

Richard Brodie R.Brodie at rl.ac.uk
Mon Dec 11 14:02:30 EST 2000


"Alex Martelli" <aleaxit at yahoo.com> wrote in message news:9131vd0pnq at news2.newsguy.com...

> What do you claim is "barbarous", "grammatically faulty",
> etc, about using "while 1:" to express "loop until
> otherwise terminated" in Python?

Speaking for myself (of course), I find it somewhat unaesthetic
to have a loop construct that doesn't document what its terminating
condition is.

The  congruence argument is an interesting one but I'm not sure
entirely to the point. I could say that I prefer:

if (condition):
    do x

rather than a construct like

    do x:
if condition.

The former let's you abstract part of the problem.

It's a valid point on the usability of the language. I'm not sure there
is a good answer to the original one though. If there were a better
pseudocode notation someone would be using it by now. Maybe just
while 1: # Loop condition

I suppose for the specific case we came in on, having an xreadlines
function (by analogy with xrange) has been discussed and rejected
before now.







More information about the Python-list mailing list