I am trying to understand what exactly a Python name binding is, and when this binding is interpreted.
In c,
include <stdio.h>
int main()
{
int X = 42;
int* Y[1];
Y[0] = &X;
X = 666;
printf("%d", *Y[0]);
return 0;
}
prints 666. I was expecting the block of Python code:
X = 42
L = []
L.append(X) #3
X = 666
print(L) #5
to do the same, but it does not. What exactly happens between the lines labeled 3 and 5? Does #3 make another reference to the object known as "42", like X, lets call it X', and store X' in the object pointed to by L, which is []?