Concrete Proposal: while ... and while ...

Paul Boddie paulb at infercor.no
Thu May 27 05:35:46 EDT 1999


Phil Hunt wrote:
> 
> In article <374AD624.AB93C9CB at infercor.no>
>            paulb at infercor.no "Paul Boddie" writes:

[Cutting leaving one example I gave earlier]

> > while:          # No getting away from this, sadly.
> >   first_part
> > break if test2  # Imaginative use of existing keywords.
> >                 # No second block, however. It could confuse.
> 
> There is already a syntax for `if' and `break' that does this, ie:
>    if test2: break

Not quite, since this is a special case - note the indentation.

> So what you are suggesting could be generalized, so that all
> statements for the form:
> 
>    if test: do_something
> 
> can be rewritten as:
> 
>    do_something if test

Not at all, as I am not suggesting that the above be anything other that the
terminating part of a loop block. I was merely exploring the possibilities using
available keywords.

> This is useful, because it offers the programmer different ways to do
> things -- different programmers prefer different ways of doing things,
> so this way they'll all get what they want.

At this point I knew what you were about to say.

> In fact, there already exists a language designed on these principles.
> It is called Perl. (Some people have even gone as far to suggest that
> Perl should replace Python as a general-purpose scripting language
> because of its superior and easier-to-understand syntax). So I suggest
> that Python 2.0 should include the entire syntax of Perl, as well as
> the ``and while test:'' and ``break if test'' constructs.

Ignoring the sarcasm, which is rather unnecessary, I did "do" Perl before I
found out about Python, so these syntactic "niceties" are not unfamiliar to me.
At first it does seem a nice idea to have lots of ways of expressing one single
concept, but only until one has to maintain Perl code from the week before.

Paul




More information about the Python-list mailing list