[PYTHON] `==` may throw an exception between objects that are circularly referenced

>>> a = []
>>> a.append(a)
>>> b = []
>>> b.append(b)
>>> a == b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: maximum recursion depth exceeded in cmp

Ruby seems to return false irb(main):001:0> a = [] => [] irb(main):002:0> a.push(a) => [[...]] irb(main):003:0> b = [] => [] irb(main):004:0> b.push(b) => [[...]] irb(main):005:0> a == b => false

Recommended Posts

`==` may throw an exception between objects that are circularly referenced
Intentionally throw an exception with raise