Commit Graph

8 Commits

Author SHA1 Message Date
Guido van Rossum 47b9ff6ba1 Restructure comparison dramatically. There is no longer a default
*ordering* between objects; there is only a default equality test
(defined by an object being equal to itself only).  Read the comment
in object.c.  The current implementation never uses a three-way
comparison to compute a rich comparison, but it does use a rich
comparison to compute a three-way comparison.  I'm not quite done
ripping out all the calls to PyObject_Compare/Cmp, or replacing
tp_compare implementations with tp_richcompare implementations;
but much of that has happened (to make most unit tests pass).

The following tests still fail, because I need help deciding
or understanding:

test_codeop -- depends on comparing code objects
test_datetime -- need Tim Peters' opinion
test_marshal -- depends on comparing code objects
test_mutants -- need help understanding it

The problem with test_codeop and test_marshal is this: these tests
compare two different code objects and expect them to be equal.
Is that still a feature we'd like to support?  I've temporarily
removed the comparison and hash code from code objects, so they
use the default (equality by pointer only) comparison.

For the other two tests, run them to see for yourself.
(There may be more failing test with "-u all".)

A general problem with getting lots of these tests to pass is
the reality that for object types that have a natural total ordering,
implementing __cmp__ is much more convenient than implementing
__eq__, __ne__, __lt__, and so on.  Should we go back to allowing
__cmp__ to provide a total ordering?  Should we provide some other
way to implement rich comparison with a single method override?
Alex proposed a __key__() method; I've considered a __richcmp__()
method.  Or perhaps __cmp__() just shouldn't be killed off...
2006-08-24 00:41:19 +00:00
Andrew M. Kuchling a6483d2e9a Remove 'created by' lines; people can use CVS for this, and the information is often out of date 2002-11-14 02:25:42 +00:00
Fred Drake b94b849d65 Whitespace normalization. 2001-12-06 20:51:35 +00:00
Andrew M. Kuchling ac20f773f3 Back out conversion to string methods; the Distutils is intended to work
with 1.5.2
2001-03-22 03:48:31 +00:00
Eric S. Raymond b3acd3e4d3 String method conversion. 2001-02-09 12:20:51 +00:00
Greg Ward be86bdea73 Standardize whitespace in function calls. 2000-09-26 01:56:15 +00:00
Jeremy Hylton a05e293a21 typos fixed by Rob Hooft 2000-06-28 14:48:01 +00:00
Greg Ward ee789b9601 Initial checkin of distutils source files. 1998-12-18 22:00:30 +00:00