Language Syntax

Dict display — Python syntax

Build a new dictionary from key-value pairs or mapping unpacking. Expressions are evaluated in order, later equal keys replace values and existing insertion positions remain unchanged. Keys must be hashable.

Formal Syntax & Structure

python syntaxpython
{key: value, **mapping, ...}

Return Value

dict

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

Working Example

Example Snippetpython
base={'a':1,'b':2}result={**base,'a':3,'c':4}print(list(result.items()))
Python Reference