[Python-Dev] ',' precedence in documentation]
fredrik at pythonware.com
Mon Sep 15 07:35:07 CEST 2008
Christopher Lee wrote:
> precedence when *both* occur in an expression, e.g. whether
> x in y,z
what part of "comma is not an operator" is so hard to understand? the
above is not an expression. it's two expressions, separated by commas.
the first expression stops at the comma. the second expression
follows after the comma.
commas can be a part of an expression only when they appear as part of a
syntactic construct that allows commas (that is, parenthesized forms and
displays, and the target list of a generator expression).
> evaluates as
> (x in y),z
> x in (y,z)
> The page that Fredrik sent you to
> (http://docs.python.org/ref/exprlists.html) doesn't address that
> question. I still think the precedence table
> (http://docs.python.org/ref/summary.html) should show that "in" has
> higher precedence than comma in an expression.
comma is not an operator.
> Can anyone show us "where it is written" in the Python docs that "in"
> has higher precedence than comma, *and* why there is a good reason that
> this information should NOT be included in the precedence table?
because comma is not an operator? if we were to list everything that
was not an operator in the precedence table, it would end up being very
long and mostly pointless.
More information about the Python-Dev