In python, a list can contain itself.
a_list = []
a_list.append(a_list)
When printed, it displays [...]
for that item. I.E., this:
a_list = [1, 2, 3]
a_list.append(a_list)
would print [1, 2, 3, [...]]
. Now, in CPython, how does this work?
Does that element of the list contain the ID of the value? Or the memory location? Is their just some sort of special placeholder marker that, when referenced, will replace itself with the original list?