Warm up¶
1) What happens when
>>> x = 1
is executed? The name “x” is assigned the value 1.
![digraph first {
rankdir=LR;
one [label = "1", style=dotted, shape=polygon];
x [label="x", shape=circle];
x -> one;
}](../../_images/graphviz-a5f1237a4cee5978673141520dfa2022df5ebf5a.png)
2) Let’s take a look at
>>> x = 1
>>> y = x
>>> print(y)
1
The name “y” is assigned the value of the name “x”.
![digraph first {
rankdir=LR;
one [label = "1", style=dotted, shape=polygon];
x [label="x", shape=circle];
y [label="y", shape=circle];
x -> one [weight=100];
y -> one;
}](../../_images/graphviz-c98fd7e3b9af17bc270e191abb26576f4a221500.png)
Nothing special so far, just terminology.
Lessons¶
Fundamental facts behind values and names in Python:
Names cannot be assigned to another name.
Assignment never copies data.