On 07/07/2014 06:18 PM, Andreas Maier wrote:
Am 2014-07-08 01:50, schrieb Ethan Furman:
I never add __eq__ to my classes until I come upon a place where I need to
check if two instances of those classes are
'equal', for whatever I need equal to mean in that case.
With that strategy, you would not be hurt if the default implementation raised
an exception in case the two objects are
not identical. ;-)
Yes, I would. Not identical means not equal until I say otherwise. Raising an exception instead of returning False
(for __eq__) would be horrible.
--
~Ethan~
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com