You can't reference list's variable location in memory through the variables it was created from. Consider this example:
a = 1; b = 2; c = 3
l = [a, b, c]
a = 5
print(a, b, c, str(l)) # Will print "5 2 3 [1, 2, 3]"
Once you modify variable a
, element l[0]
will point to a different location in memory. Check out this article to learn more about how memory works in python.