On Wed, 2002-05-01 at 12:22, Allison Randal wrote:
> On Wed, May 01, 2002 at 09:03:42AM -0500, Jonathan Scott Duff wrote:
[... in python ...]
> >     while_stmt ::= "while" expression ":" suite
> >                     ["else" ":" suite]
> > 
> > That's straight from http://www.python.org/doc/current/ref/while.html.

> If you abstract the meaning of C<else> to "execute when the condition in
> the previous block is false" this makes perfect sense. It's just not
> very useful. This is actually a good reason for Perl to use a different
> keyword than "else" with loops. You avoid that interpretation entirely.
> You also avoid totally annoying Pythonists who occasionally use (and
> might be converted to) Perl. :)

So, the Python while is the Perl6:

        loop {
                if (<expression>) {
                        <suite>
                } else {
                        <suite>
                        last;
                }
        }

This is not shocking at all, as Python does not dip into the
polymorphism of containers nearly so much as Perl does. To Python,
evaluating the "truth" of a sequence of this type requires there to be a
truth already present. In this case, the truth of the last evaluation of
the expression suffices.

Perl is fundamentally different in its approach and just as a Pythoner
will have to swallow hard and squint to understand other polymorphic and
context-sensitive aspects of Perl containers, so too will they have to
get over this distinction.

I'm not slighting Python here. I'm just saying that there's a learning
curve fraught with dangerous similarities in both directions, and
constructing Perl to accommodate that transition does not seem to be
particularly wise.


Reply via email to