Reputation: 6748
In [81]: a
Out[81]: [[...]]
In [82]: b
Out[82]: [[Ellipsis]]
In [83]: a==b
Out[83]: False
In [84]: ...==Ellipsis
Out[84]: True
Why it is that when Ellipsis are in lists they are not equal, and when they are by themselves they are equal?
Upvotes: 1
Views: 226
Reputation: 140138
Check that
>>> [[...]] == [[Ellipsis]]
True
but
>>> a = []
>>> a.append(a)
>>> a
[<Recursion on list with id=70796424>]
>>> print(a)
[[...]]
>>> a==[[Ellipsis]]
False
>>>
which is expected because you're comparing the Ellipsis
object with an ellipsis representation of a recursively defined list.
Upvotes: 2