python: bug or feature?

Gregory Lielens gregory.lielens at fft.be
Fri Aug 11 08:57:16 EDT 2000


Grant Edwards wrote:

> Sure. I've used various other "technologies" for expressions (prefix,
> postfix, infix with no precedence, whatever-you-call-what-Smalltalk-uses).
> Pick one. It's OK with me. But, if we're going to have "standard" prececence
> for some sets of operators, we ought to go by the standard for all sets.
> 
> I think that "*" having higher precidence than "+" but having "&" and "|"
> the same violates the "rule of least surprises".

I agree with you on this, the symetry between logical and arithmetic
operator would be breaked if dissimilar precedence rules were adopted. I
was also wondering why no xor seems to exist in Python? if ^ exist,
better to have the logical version also:


not or and   xor -oops- syntax error
~   |   &    ^
-   +   *    no equivalent - at least none I am aware of

BTW, I am also in favor of a named of bitwise operators, like ~and
instead of &...Two dissibmilar syntax for ops who are so strongly
similar is also a surprise, at least for me...


Greg.



More information about the Python-list mailing list