#
5. Expressions

This chapter explains the meaning of the elements of expressions in Python.

Syntax Notes: In this and the following chapters, extended BNF notation will be used to describe syntax, not lexical analysis. When (one alternative of) a syntax rule has the form

  `name` | ::= | `othername`

and no semantics are given, the semantics of this form of `name` are the same as for `othername`.

Subsections

- 5.1 Arithmetic conversions
- 5.2 Atoms
  - 5.2.1 Identifiers (Names)
  - 5.2.2 Literals
  - 5.2.3 Parenthesized forms
  - 5.2.4 List displays
  - 5.2.5 Dictionary displays
  - 5.2.6 String conversions
- 5.3 Primaries
  - 5.3.1 Attribute references
  - 5.3.2 Subscriptions
  - 5.3.3 Slicings
  - 5.3.4 Calls
- 5.4 The power operator
- 5.5 Unary arithmetic operations
- 5.6 Binary arithmetic operations
- 5.7 Shifting operations
- 5.8 Binary bit-wise operations
- 5.9 Comparisons
- 5.10 Boolean operations
- 5.11 Lambdas
- 5.12 Expression lists
- 5.13 Summary