[Python-Dev] Keep default comparisons - or add a second set?
Scott David Daniels
Scott.Daniels at Acm.Org
Wed Dec 28 07:53:37 CET 2005
Jim Jewett wrote:
> Jim Fulton asked how this canonical ordering
> should be defined.
>
> The obvious answer is "Just like the __lt__
> operator today". But it doesn't actually *need*
> to be that sensible, if there are strong reasons
> to prefer a simpler ordering.
>
> The more I think about it, though, __eq__ really
> does need to be honored; I don't want an
> "Are these two containers equivalent?"
> test to depend on how well the memory
> subsystem happened to be working.
>
> Given that, also honoring an explicit __lt__
> isn't much of an extra burden, and will make
> the ordering much more useful for debugging
> and output.
Tell me:
>>> a = [0] * 3
>>> b = [0] * 3
>>> a[0] = b
>>> b[0] = a
What order should a and b have?
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-Dev
mailing list