Concrete Proposal: while ... and while ...
Phil Hunt
philh at vision25.demon.co.uk
Thu May 20 16:15:35 EDT 1999
In article <7hvvto$ifj$1 at news.tamu.edu>
cwebster at math.tamu.edu "Corran Webster" writes:
> In article <927132579snz at vision25.demon.co.uk>,
> Phil Hunt <philh at vision25.demon.co.uk> wrote:
> >In article <7hsv80$g9j$1 at news.tamu.edu>
> > cwebster at math.tamu.edu "Corran Webster" writes:
> >
> >If this is added to the language, it will make programs harder to read.
> >
> >With your notation the ``and while ...'' line goes at the same level of
> >indentation as the original ``while'' line; this makes it look as if it
> >is ending that block and starting another one.
>
> This is part of the point - it _is_ starting a new block. I don't see
> it as making things any harder to read than "if .. elif ... else" or
> even the existing "while ... else ..." constructions.
True, but if is harder to read than:
while 1:
xxxx()
if test: break
yyyy()
> >Or better still, just use ``if not test: break''.
>
> Which you still can under this proposal.
My understanding is that ``and while test:'' means exactly the same
as ``if not test: break''. So why add it? All it does is make the
syntax more complicated, and therefore harder to learn.
> >IMO allowing ``while:'', meaning ``while 1:'' is a reasonable shortcut.
>
> I'd agree with you here, but to allow it by itself would have added
> another level of complexity to the patch. But it's not so much the "1"
> in there which irks me so much as the whole convoluted construct. I'd
> much rather have something cleaner available.
Alright then, how about a ``loop:'' or ``forever:'' construct instead
of ``while 1:''? (Of course, these use a new keyword).
--
Phil Hunt....philh at vision25.demon.co.uk
More information about the Python-list
mailing list