python: bug or feature?

Grant Edwards ge at nowhere.none
Thu Aug 10 15:34:27 EDT 2000


>I understand why they might need a different level from logical operators.
>But why not just one bitwise level?

Surely you're joking?

The same reason there are different precedence levels for the
arithmetic operators +,-,*,/.  Because that's how everybody
_expects_ things to behave based on years of experience with
other languages and because we were taught math that way even
before we started using computers.

When somebody sees the expression 

            3x+1
            
They expect it to mean (3x) + 1, and not 3(x+1).  So that's
the way operator precedence was defined for programming
languages.

>Is the individual precedence levels for bitwise operators so
>obvious that users could avoid using parenthesis and ckecking
>docs?  Does the language really need four separate precedence
>levels just for bitwise operation?

It needs at least three to be consistent with the way boolean
expression are generally used.

-- 
Grant Edwards                   grante             Yow!  Did YOU find a
                                  at               DIGITAL WATCH in YOUR box
                               visi.com            of VELVEETA?



More information about the Python-list mailing list