[Python-Dev] == on object tests identity in 3.x

Andreas Maier andreas.r.maier at gmx.de
Fri Jul 11 16:10:47 CEST 2014


Am 08.07.2014 05:47, schrieb Ethan Furman:
> On 07/07/2014 08:34 PM, Stephen J. Turnbull wrote:
>> Ethan Furman writes:
>>
>>> And what would be this 'sensible definition' [of value equality]?
>>
>> I think that's the wrong question.  I suppose Andreas's point is that
>> when the programmer doesn't provide a definition, there is no such
>> thing as a "sensible definition" to default to.  I disagree, but given
>> that as the point of discussion, asking what the definition is, is moot.
>
> He eventually made that point, but until he did I thought he meant that
> there was such a sensible default definition, he just wasn't sharing
> what he thought it might be with us.

My main point is that a sensible definition is up to the class designer, 
so (all freedom at hand) would prefer an exception as default. But that 
cannot be changed at this point, and maybe never will. And I don't 
intend to stir up that discussion again.

I dropped my other point about a better default comparison (i.e. one 
with a result, not an exceptioN). It is not easy to define one unless 
one comes to types such as sequences or integral types, and they in fact 
have defined their own customizations for comparison.

Bottom line: I'm fine with just a doc patch, and a testcase improvement :-)

Andy



More information about the Python-Dev mailing list