We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

Parenthesized forms

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

Syntax:

( 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.