73 lines
1.9 KiB
Plaintext
73 lines
1.9 KiB
Plaintext
From: mlh at idt.ntnu.no (Magnus L. Hetland)
|
|
Date: 19 May 1999 23:50:06 +0200
|
|
Subject: Concrete Proposal: while ... and while ...
|
|
References: <7hsv80$g9j$1@news.tamu.edu> <y0j675pmg6c.fsf@vier.idi.ntnu.no> <7hufdb$rrh$1@news.tamu.edu>
|
|
Message-ID: <y0j3e0sn301.fsf@vier.idi.ntnu.no>
|
|
Content-Length: 1539
|
|
X-UID: 1823
|
|
|
|
cwebster at math.tamu.edu (Corran Webster) writes:
|
|
|
|
> In article <y0j675pmg6c.fsf at vier.idi.ntnu.no>,
|
|
> Magnus L. Hetland <mlh at idt.ntnu.no> wrote:
|
|
> >cwebster at math.tamu.edu (Corran Webster) writes:
|
|
> >
|
|
[...]
|
|
>
|
|
> It might be the Guido-approved version - I can't recall the exact form
|
|
> of the approved form. If this is in fact it, then I think my proposal
|
|
> has a slight advantage over this in simplicity. This form allows two
|
|
> tests (presuming something other than '1' is permitted after the first
|
|
> while), where my proposal has precisely one test for the loop, which
|
|
> seems more natural to me.
|
|
|
|
Maybe -- but then the keyword "while" seems a bit strange...
|
|
|
|
while:
|
|
line = readline()
|
|
and while line:
|
|
print line
|
|
|
|
To me, the "while: line=readline()" sounds like some kind of
|
|
condition, and it certainly isn't... I would find this more
|
|
understandable:
|
|
|
|
repeat:
|
|
line = readline()
|
|
and while line:
|
|
print line
|
|
|
|
But then we have another keyword again...
|
|
|
|
>
|
|
> No, "while:" is not permitted without the "and while" later. The precise
|
|
> grammar is
|
|
>
|
|
> while [':' suite 'and' 'while'] test ':' suite ['else' ':' suite]
|
|
>
|
|
|
|
OK - I see.
|
|
|
|
[snip]
|
|
|
|
> It seems to me that with this change, 'while 1:' will be used much
|
|
> less often, and it's not worth the additional complexity to make
|
|
> the '1' optional.
|
|
|
|
I agree... I think I meant it should be obligatory, since I find
|
|
"while:" even more meaningless <wink>. Oh, well...
|
|
|
|
>
|
|
> Corran
|
|
>
|
|
|
|
--
|
|
|
|
Magnus
|
|
Lie
|
|
Hetland http://arcadia.laiv.org <arcadia at laiv.org>
|
|
|
|
|
|
|
|
|