Maybe a similar example in C
will help explain?
#include <stdio.h>
typedef struct _node {
struct _node *next;
int value;
} node;
int main(void) {
node a_node;
a_node.next = &a_node;
a_node.value = 1;
node *curr = &a_node;
for (int index = 0; index < 3; index ++) {
printf("curr = %p, curr->value = %d\n", curr, curr->value);
curr = curr->next;
}
return 0;
}
Output
$ ./main
curr = 0x7fff3f26d5c8, curr->value = 1
curr = 0x7fff3f26d5c8, curr->value = 1
curr = 0x7fff3f26d5c8, curr->value = 1
You can experiment with the repli.it. Try increasing 3
to a very large number.
Add something like this to your repl.it
to get something similar in python
:
z = x
for count in range(10):
print(id(z))
z = z[0]