Re:A Guide to Python's Magic Methods
by jerf on Saturday March 17, 2012 @03:12PM
(#3717895)
The word example is dangerous; two different words of the same length are neither less than each other, greater than each other, or equal to each other. I think sorting may not work as well as you'd like, and you should just be passing a custom cmp function to the sort method. The other comparison methods are for optimization; they should never disagree with __cmp__, and if __cmp__ is already optimal you should usually not define them.
[ Parent
| on HN ]
There are no comments on this comment yet.