Next: Assignment statements Up: Simple statements Previous: Simple statements

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):


expression_stmt: expression_list

An expression statement evaluates the expression list (which may be a single expression). If the value is not None, it is converted to a string using the rules for string conversions (expressions in reverse quotes), and the resulting string is written to standard output (see section ) on a line by itself.

(The exception for None is made so that procedure calls, which are syntactically equivalent to expressions, do not cause any output. A tuple with only None items is written normally.)


guido@cwi.nl