[Python-Dev] == on object tests identity in 3.x (original) (raw)
Ethan Furman ethan at stoneleaf.us
Tue Jul 8 04:29:17 CEST 2014
- Previous message: [Python-Dev] == on object tests identity in 3.x
- Next message: [Python-Dev] == on object tests identity in 3.x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] == on object tests identity in 3.x
- Next message: [Python-Dev] == on object tests identity in 3.x
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]