DAGDA SEARCH | Back to results | Support

5.11 Expression lists

Source: https://docs.python.org/2.0/ref/exprlists.html

Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5.10 Boolean operations Up: 5. Expressions Next: 5.12 Summary


5.11 Expression lists

expression_list:      expression ("," expression)* [","]

An expression list containing at least one comma yields a tuple. The length of the tuple is the number of expressions in the list. The expressions are evaluated from left to right.

The trailing comma is required only to create a single tuple (a.k.a. a singleton); it is optional in all other cases. A single expression without a trailing comma doesn't create a tuple, but rather yields the value of that expression. (To create an empty tuple, use an empty pair of parentheses: ().)


Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5.10 Boolean operations Up: 5. Expressions Next: 5.12 Summary


See About this document... for information on suggesting changes.