Re: [Python-Dev] Overloading comparison operator for lists

2019年5月28日 22:46:09 -0700

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
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to