GNU Info

Info Node: (python2.1-ref.info)Parenthesized forms

(python2.1-ref.info)Parenthesized forms


Next: List displays Prev: Literals 2 Up: Atoms
Enter node , (file) or (file)node

Parenthesized forms
-------------------

A parenthesized form is an optional expression list enclosed in
parentheses:

     parenth_form:      "(" [expression_list] ")"

A parenthesized expression list yields whatever that expression list
yields: if the list contains at least one comma, it yields a tuple;
otherwise, it yields the single expression that makes up the expression
list.

An empty pair of parentheses yields an empty tuple object.  Since
tuples are immutable, the rules for literals apply (i.e., two
occurrences of the empty tuple may or may not yield the same object).

Note that tuples are not formed by the parentheses, but rather by use
of the comma operator.  The exception is the empty tuple, for which
parentheses _are_ required -- allowing unparenthesized "nothing" in
expressions would cause ambiguities and allow common typos to pass
uncaught.


automatically generated by info2www version 1.2.2.9