Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

Operator =

Binds a name to the object produced by the right-hand expression.

Version: Python 3.14; repository image, production runtime not attested

Syntax

name = expression

Binds a name to the object produced by the right-hand expression.

The expression on the right is evaluated before assignment to the target. An ordinary name stores a reference and imposes no fixed type on future assignments.

An attribute or item target has different semantics from a local name. It invokes assignment on the receiving object and can fail, for example when assigning to a tuple item.

Mutating a shared list through one name changes what aliases observe.

Syntax

name = expression

name = expression · target[index] = expression

Worked example

x = [2]; y = x; x.append(5)
y → [2, 5]
x = []; y → [2, 5]
values = (2, 3); values[0] = 8 → TypeError

Examples

items = [3]
alias = items
items.append(5)
print(alias is items)
print(alias)

Result

True
[3, 5]

Mutating a shared list through one name changes what aliases observe.

Sources