This is just a theoretical question and doesn't have any use case I believe.
I was playing with lists self reference and I noticed that:
>>> l = []
>>> l.append(l)
>>> l.append(l)
>>> l
[[...], [...]]
>>> l+l
[[[...], [...]], [[...], [...]], [[...], [...]], [[...], [...]]]
And ok the output seems fine? Then I tried:
>>> l = []
>>> l.append(l)
>>> l.append(l)
>>> l
[[...], [...]]
>>> l.extend(l)
>>> l
[[...], [...], [...], [...]]
I thought l+l
and l.extend(l)
would behave the same way with the only difference that list+list
creates a copy
I then checked references but they are all the same:
>>> l = []
>>> l.append(l)
>>> l.append(l)
>>> l
[[...], [...]]
>>> l+l
[[[...], [...]], [[...], [...]], [[...], [...]], [[...], [...]]]
>>> e =l+l
>>> e[0][0] is e[0][1]
True
>>> e[0][0] is e[0]
True
>>> e[0] is e[1]
True
TLDR Why
>>> l+l
[[[...], [...]], [[...], [...]], [[...], [...]], [[...], [...]]]
But
>>> l.extend(l)
>>> l
[[...], [...], [...], [...]]