while true: !!!

Oldayz sill at localhost.kitenet.net
Fri Dec 15 16:59:56 EST 2000


On Fri, 15 Dec 2000 14:08:15 +0100, Alex Martelli <aleaxit at yahoo.com> wrote:
>"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:
>>       ...
>>
>> :-)

Sarcasm notwithstanding, I think forever: makes
sense because the idiom suggests the code will
execute forever, unless something (say a break
statement) stops it. The question is whether
while 1: is common enough to deserve a separate
name for it - to be honest, i'm almost certain
it does not, even though it's a matter of taste.

Hey, how about if you think while 1: looks ugly
you do true = 1 somewhere on top and use
while true: ? I think it's much more obvious
and clean and you don't need to change syntax.

Ideally, language should stay fairly close to
the way we normally think; in this case it's
the difference between thinking 'walk north
until the heat death of the universe BUT if
you see grocery, get in, buy apple juice and
return home' and 'go to grocery, buy apple
juice and return home'. I usually think in
a latter manner but YMMV ;-).

OTOH, i'm a newbie and I can be totally off
base here, am I?

-- 

	Andrei



More information about the Python-list mailing list