Concrete Proposal: while ... and while ...
Corran Webster
cwebster at math.tamu.edu
Wed May 19 23:49:00 EDT 1999
In article <y0j3e0sn301.fsf at vier.idi.ntnu.no>,
Magnus L. Hetland <mlh at idt.ntnu.no> wrote:
>cwebster at math.tamu.edu (Corran Webster) writes:
>>
>
>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...
I'm in agreement with you here, althought I'd prefer
do:
line = readline()
while test:
print line
although perhaps the "and" does fit in there better. The suggestion of
"given test:" or something along those lines also has some resonance.
But let's face it, the exact spelling isn't a huge problem as long as
it does what you want unambiguously. Many programmers seem to cope with
"for (i = 0; i < n; i++)" without their brains exploding. :)
>> 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...
OK - I misunderstood what you were saying. My apologies.
I can cope with "while:" but agree it seems more natural with a test
of some sort there.
It seems that this is an area where compromises will have to be made
one way or the other.
Corran
More information about the Python-list
mailing list