Language Syntax

List display — Python syntax

Create a new mutable list from zero or more expressions. Elements are evaluated left to right, and starred items expand their iterable values. The list contains references, not recursive copies.

Formal Syntax & Structure

python syntaxpython
[expression, *iterable, ...]

Return Value

list

Value obtained by evaluating this expression; see description for context and constraints.

Working Example

Example Snippetpython
inner=[1]items=[inner,*[2,3]]inner.append(4)print(items)
Python Reference