Note: In this and the following chapters, extended BNF notation
will be used to describe syntax, not lexical analysis.
This chapter explains the meaning of the elements of expressions and
conditions. Conditions are a superset of expressions, and a condition
may be used wherever an expression is required by enclosing it in
parentheses. The only places where expressions are used in the syntax
instead of conditions is in expression statements and on the
right-hand side of assignment statements; this catches some nasty bugs
like accidentally writing x == 1 instead of x = 1.
The comma plays several roles in Python's syntax. It is usually an
operator with a lower precedence than all others, but occasionally
serves other purposes as well; e.g. it separates function arguments,
is used in list and dictionary constructors, and has special semantics
in print statements.
When (one alternative of) a syntax rule has the form
name: othername
and no semantics are given, the semantics of this form of name
are the same as for othername.