[Python-Dev] Re: Re: lists v. tuples

Andrew Koenig ark@research.att.com
15 Mar 2003 18:44:36 -0500


Guido> Yes.  And I'm still hoping to remove __cmp__; there should be
Guido> only one way to overload comparisons.

Moreover, for some data structures, the __cmp__ approach can be
expensive.  For example, if you're comparing sequences of any kind,
and you know that the comparison is for == or !=, you have your answer
immediately if the sequences differ in length.  If you don't know
what's being tested, as you wouldn't inside __cmp__, you may spend a
lot more time to obtain a result that will be thrown away.

-- 
Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark