Rocco Moretti wrote: > The main problem is that Python is trying to stick at least three > different concepts onto the same set of operators: equivalence (are > these two objects the same?), ordering (in a sorted list, which comes > first?), and mathematical "size".
A possible compromise would be to add a new special method, such as __equal__, for use by == and != when there is no __eq__ or __ne__. Then there would be three clearly separated levels of comparison: (1) __cmp__ for ordering, (2) __equal__ for equivalence, (3) __eq__ etc. for unrestricted semantics. > This gives the wacky world where > "[(1,2), (3,4)].sort()" works, whereas "[1+2j, 3+4j].sort()" doesn't. To solve that, I would suggest a fourth category of "arbitrary ordering", but that's probably Py3k material. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list