GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — 5.2.3 Parenthesized forms

Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5.2.2 Literals Up: 5.2 Atoms Next: 5.2.4 List displays


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


Previous Page Up One Level Next Page Python Reference Manual Contents Index
Previous: 5.2.2 Literals Up: 5.2 Atoms Next: 5.2.4 List displays

See About this document... for information on suggesting changes.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.