while true: !!!

Alex Martelli aleaxit at yahoo.com
Fri Dec 15 14:08:15 CET 2000


"Greg Ewing" <greg at cosc.canterbury.ac.nz> wrote in message
news:3A397C74.6C8906E1 at cosc.canterbury.ac.nz...
> Oldayz wrote:
> >
> > I thought something like forever: would be even more lucid
>
> If there is a break in the loop somewhere, it's
> not really forever, though, is it?
>
> So perhaps it should *really* be
>
>    for a while:
>       ...
>
> :-)

Why not have a 'built-in constant' it_lasts, of value 1,
so we can write:

    while it_lasts:
        ...

This requires no change to existing Python syntax.  For
the incurable romantics, besides allowing a 'for' statement
form with a single parameter so cynics can write

    for awhile:
        ...

and romantics can write:

    for ever:
        ...

we should also introduce an 'until' statement, and a
death_do_us_part built-in constant, of course.


Alex






More information about the Python-list mailing list