Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: