while true: !!!

Alex Martelli aleaxit at yahoo.com
Mon Dec 11 12:13:07 EST 2000


"Steve Williams" <sandj.williams at gte.net> wrote in message
news:3A350405.B8F09EC7 at gte.net...
    [snip]
> I wouldn't call "While true" a python-idiom, I'd call it a
> python-solecism.

With some effort, I guess one MIGHT find assertions with
which I'd disagree more drastically than this one -- but,
it WOULD take effort.

How *WOULD* you prefer to express Knuth's classical
"N-times-and-a-half" loop (in Python, C, C++, Java, &c)
if not by (pseudocode):

    'loop until otherwise terminated':
        'first-part' suite of statements
        if 'termination-condition': break
        'second-part' suite of statements

...?

The 'loop until otherwise terminated' clause is _best_
spelled
    while 1:
in Python, while other languages offer you a choice
between
    for(;;)
and
    while(1)
as well as
    do
(with a while(1) at the end), etc.


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


Alex






More information about the Python-list mailing list