[Python-Dev] Overloading comparison operator for lists
On 5/28/2019 11:35 PM, Montana Burr wrote:
> What is the justification for causing list == 3 to evaluate to False,
> besides the obvious "a list cannot equal a number"?
That is completely sufficient. The default comparison is by id, and a
class must override to get something different. The 'default' override
is compare by class and if equal, compare by value. Numbers are odd in
allowing instances of different classes compare equal.
Terry Jan Reedy