operator precedence

sage: 3==3+1
False
Correct, because concerning to the perecedence list on http://www.sagemath.org/doc/tutorial/appendix.html + has a higher precedence than ==. The text says, that the table is based on the table in ยง 5.14 of the /Python Language Reference Manual/, but that is not complete as well.

There the shortcut operators +=, -=, *=, /= are missing and the = (normally equivalent precedence) are missing as well.
sage: x=3==3
sage: x+=3==3
sage: x
2
sage:

Parenthesis have high precendence, normally highest (beside Object operators), but are missing in Sage table
sage: (3==3)+1
2

sage: a=3==3; b=a+1
sage: a,b
(True, 2)
sage:
sage:

The Operator == has higher precedence than =, but the later is missing as well in the sage table.

Regards BB







--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to