So here is the construct
#list1 and list2
list1 = [(True,), (True,)]
list2 = [(True,), (True,)]
#Transformation
list1[0] = list2
list1[1] = list1
list2[0] = list1
list2[1] = list2
Which gives:
#Result
#list1 = [ list2 , list1 ]
#list2 = [ list1 , list2 ]
When I run this code
>>>list2 in list1
True
>>>list1 in list1
RuntimeError: maximum recursion depth exceeded in comparison
I believe the error occurs because getting the actual value of list1 for comparison results in an endless loop. However, list2 does not result in this error despite being constructed similarly.
So my question is, why is there a discrepancy in the error? Shouldn't "list2 in list1" cause an error too?