Le 08/10/2011 17:16, Dave Angel a écrit :

You should say
"... parenthesis are not necessary ("not" has LOWER precedence than "in")."



I should, yes, I confess ;)


In my defense, I must tell that Python document reference here :

http://docs.python.org/reference/expressions.html#summary


has an anti-iconic way to display the order precedence.


If an operator OP1 has higher precedence than an operator OP2 , it means that, at evaluation time, you execute OP1 FIRST and operator OP2 later. So, its seems very natural to present FIRST operator with stronger precedence.


So, if you iconically present this material in a tabular display, you present FIRST (ie at the top because usually we process tabular material starting on the upper part) what you need to calculate FIRST and, again, you present

at the TOP the HIGHer precedence

and

at the BOTTOM the LOWer precedence.

Documentations usually provide the table in this order (higher to lower), cf. the table in K&R book for C programing language or here for the C++ PL :

http://en.cppreference.com/w/cpp/language/operator_precedence

or again there for the Java PL :

http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html








--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to