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

"Martin v. Löwis" martin at v.loewis.de
Wed Aug 29 20:17:57 CEST 2007


> Do you know why? Thanks!

It's a matter of precedence: ** has higher precedence
than unary + and -, which has higher precedence than / and *,
which have higher precedence than binary + and -. See
power, factor, term in Grammar/Grammar.

I'm not sure why precedence was defined that
way, though.

Regards,
Martin


More information about the Python-Dev mailing list