PEP 308: I liked the original proposal better

Andrew Bennetts andrew-pythonlist at puzzling.org
Mon Feb 17 19:14:36 EST 2003


On Tue, Feb 18, 2003 at 11:22:24AM +1300, Greg Ewing (using news.cis.dfn.de) wrote:
> Jp Calderone wrote:
> 
> >>>>function('oh') * function(4) + function(3) * function('my') 
> >>>>
> >rar,  oh  is evaluated!
> >rar,  4  is evaluated!
> >rar,  3  is evaluated!
> >rar,  my  is evaluated!
> >
> >   See?
> 
> 
> I think the point wasn't the order the operands are
> evaluated in, but the order the operations are done in.
> You already have to think out-of-order to understand
> arithmetic expressions, so out-of-order thinking in
> conditional expressions wouldn't be a big deal.

The order of arithmetic operations is drilled into every student during
school.  It's natural, and besides, I always use parens for any expression
that looks too complex.

And again, I can read 
    a * b + c * d
from left-to-right.

Doing
    w + x * y + z
is perhaps harder to read, but I usally wouldn't write it that way anyway.
And due to using symbols, not words, for operators, the "*" stands out from
the surrouding identifiers, and my attention is immediately drawn by
force-of-habit to the "x * y".  I doubt that I will find "val1 if cond else
val2" as easy, even after a long acquaintance.

In short: It just feels wrong, and no amount of telling me it shouldn't is
going to change that.  I also worry that it sets a bad precedent for future
syntax additions to take similar liberties with ordering.

-Andrew.






More information about the Python-list mailing list