What's exactly happening in infinite nested lists?
问题 It's possible to create an infinite nested list in Python. That's clear and, although not popular and definitely not useful is a known fact. >>> a = [0] >>> a[0] = a >>> a [[...]] >>> a[0] == a True My question is, what is happening here: >>> a = [0] >>> b = [0] >>> a[0], b[0] = b, a >>> a [[[...]]] >>> b [[[...]]] >>> a == b Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: maximum recursion depth exceeded in cmp >>> a[0] == b True >>> a[0][0] == b