[Python-Dev] re: syntax feedback from LANL course (very long)

Christian Tismer tismer@tismer.com
Fri, 04 Feb 2000 20:11:11 +0100


Tim Peters wrote:
> 
> Just picking on the loop issue here.

...

> >>         while:
> >>             first-half
> >>         and while condition-1:
> >>             second-half
> >>         and while condition-2:
> >>             third-half # [sic]
> >>         and while final-condition # no trailing ':'
> 
> > This *is* confusing.
> 
> It's from an old c.l.py thread; don't recall who suggested it; I don't like
> it myself; "and while xxx:" is just sugar for "if not xxx: break"; its
> advantage is the absence of new keywords; the "while:" at the top reads
> poorly; the semantics of "and while" are indeed unclear at first (IIRC,
> Christian took way too many drugs at the time <wink> and tried to generalize
> it to "and if" as well ...).

Yes I'm still ashamed on that. It may be that Guido was about
to say "perhaps" (as worthy as a woman's "perhaps", you know),
but I went too far and killed it by "and if". Sigh...
SORRY!

> > "do" doesn't even have to be made into a keyword for the
> > do...while construct to work: there is no other valid
> > construct in which a name would appear followed by a colon
> > as the first thing in a statement or expression, so the
> > parser should be able to figure it out.
> 
> Good point!  Not the kind of point Guido warms to instantly, but a good
> point all the same.  I had already checked, and there are at least two
> functions named "do" in Python's own std distribution.  So making "do" a
> keyword is very unattractive.  I'm not sure "repeat:" (a la Pascal) or
> "loop:" (Icon? too lazy to look it up -- *one* of those loser languages I'm
> always irritating people about <wink>) would actually be better.  If hackery
> could overload "do" (or repeat, or loop), I'm in favor of it.

Oh, much simpler: We have it all ready :)

Just make "while 1:" into a keyword, like the #end block delimiters.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Düppelstr. 31                :    *Starship* http://starship.python.net
12163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home