I found an "interesting" question about list.
list1 = [1, 2, 3]
list1.insert(3, list1)
print(list1)
[1, 2, 3, [...]]
POP = list1.pop()
print(POP)
[1, 2, 3]
list1.extend(['a', 'b', 'c'])
print(POP)
[1, 2, 3, 'a', 'b', 'c']
Those are shown in the interactive mode. Of course, I know "insert" can only insert one object into the list. However when I insert list1
into list1
. It shows [...]
, what does it mean? Moreover, POP = list1.pop()
, isn't that pop can only return the final object to you? After extend the list, the final object should be 'c'. Why it returns the whole list1
but without [...]
?