[Python-Dev] Order of operations (was: PEP 238 - The // operator should truncate instead of floor)

skip at pobox.com skip at pobox.com
Wed Aug 29 22:20:58 CEST 2007


    >>> Do you know why? Thanks!
    >> 
    >> I'm not sure why precedence was defined that
    >> way, though.

    Scott> Because it is consistent with C's precedence rules.

True enough, however Python doesn't support negative numbers as individual
tokens at the lexical analysis level.  -3.41 is '-' followed by '3.41'.  In
C it's a single token resolved at compile time.  In the not-too-distant past
negative numeric constants were tried, but that caused some other grief.  I
can't remember what.

Skip


More information about the Python-Dev mailing list