while true: !!!

Fredrik Lundh fredrik at effbot.org
Mon Dec 18 05:05:30 EST 2000


Blair Lowe wrote:

<rant>

> >The idiom is actually
> >
> >while 1:
> >
> > do something
> >     if condition:
> >        break
> >
> > do something else
> >
> >Basically, it's for dealing with situations where you can't tell at the
> >beginning or end of a loop if the loop is completed - only somewhere
> >in the middle. The canonical example is
>
> This is exactly what a python program should be NOT doing.

bullshit.

the "while 1" loop IS the standard Python idiom.

no matter what you think, that won't change.  get over it.

> "while 1" is one of the most cryptic statements in Computer
> Science.

what planet do you live on?

> It is cheap to define true and false once, or (my favourite) define
> ever (;;). Although the definition is cryptic, the resulting code is
> very readable.

really?  in what english language does

    "while true"

make any more sense than

    "while 1"

maybe you meant:

    "while true is true"

which, of course, is just plain silly.

:::

can we please kill this thread now?

instead of repeating the same stupid opinions over and over
again, do something useful.  there are lots of PEPs that could
need your input:

    http://python.sourceforge.net/peps/

if you find something to complain about in there, post to this
forum (but not to this thread, please).

(and if you really think that "while 1" is the biggest problem on the
planet right now, feel free to contribute a "how to write potentially
endless loops" PEP.  just make sure to include all points of view...)

</rant>

</F>





More information about the Python-list mailing list