This chapter explains the meaning of the elements of expressions in Python.
本章描述了Python中表达式的组成元素的含义。
Syntax Notes: In this and the following chapters, extended BNFnotation will be used to describe syntax, not lexical analysis. When (one alternative of) a syntax rule has the form
句法注意:在本章和之后的章节中,描述句法时使用与词法分析时不同的扩展BNF记法。当某个句法规则(可能是可选的)具有如下形式
name |
::= | othername |
and no semantics are given, the semantics of this form of
name are the same as for othername.
并且未给出特定语义时,name的这种形式规则的意义就是其与othername含义相同。
When a description of an arithmetic operator below uses the phrase ``the numeric arguments are converted to a common type,'' the arguments are coerced using the coercion rules listed at the end of chapter 3. If both arguments are standard numeric types, the following coercions are applied:
当用以下短语"数值型参数转换为通用类型"描述数值型操作数时, 参数使用第三章中结尾处的强制规则进行强制转换.如果两个参数都属于标准数值型的, 就使用以下的强制规则:
Some additional rules apply for certain operators (e.g., a string left argument to the `%' operator). Extensions can define their own coercions.
对于某些运算符有特殊的规则(例如, "