6.1 表达式语句 Expression statements

Expression statements are used (mostly interactively) to compute and write a value, or (usually) to call a procedure (a function that returns no meaningful result; in Python, procedures return the value None). Other uses of expression statements are allowed and occasionally useful. The syntax for an expression statement is:

表达式语句用于计算和写一个值(多用在交互方式下), 或调用一个过程(一个返回没有意义的结果的函数; 在Python中, 过程返回值None). 其它表达式语句的使用方法也允许, 有时也用的到.表达式语句的句法如下:

Download entire grammar as text.

An expression statement evaluates the expression list (which may be a single expression).

一个表达式语句要对该表达表(可能只是一个表达式)求值.

In interactive mode, if the value is not None, it is converted to a string using the built-in repr()function and the resulting string is written to standard output (see section 6.6) on a line by itself. (Expression statements yielding None are not written, so that procedure calls do not cause any output.)

在交互方式下, 如果其值不为None, 就使用内建函数repr()并将结果串写入标准输出(见6.6节), 返回None的过程不回写, 所有过程调用没有任何输出.)