equality & comparison by default (was Re: Too many 'self' in python.That's a big flaw in this language.)

Erik Max Francis max at alcyone.com
Wed Jun 27 21:51:19 EDT 2007


Aahz wrote:

> In article <1i0cy8z.z94q5d1dxgexxN%aleax at mac.com>,
> Alex Martelli <aleax at mac.com> wrote:
>> In Python 3000, ordering comparisons will not exist by default (sigh, a
>> modest loss of practicality on the altar of purity -- ah well, saw it
>> coming, ever since complex numbers lost ordering comparisons), but
>> equality and hashing should remain just like now (yay!).
> 
> While emotionally I agree with you, in practice I have come to agree
> with the POV that allowing default ordering comparisons between disjoint
> types causes subtle bugs that are more difficult to fix than the small
> amount of boilerplate needed to force comparisons when desired.

I agree.  It makes more sense to have to specify an ordering rather than 
assume an arbitrary one that may or may not have any relation to what 
you're interested in.

I always did think that the inability to compare complex numbers was a 
bit of a wart -- not because it's not mathematically correct, since it 
is, but rather since everything else was comparable, even between 
distinct types -- but I think the more sensible approach is to allow 
equality by default (which defaults to identity), and only support 
comparisons when the user defines what it is he wants them to mean.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
   Water which is too pure has no fish.
    -- Ts'ai Ken T'an



More information about the Python-list mailing list