how to convert code that uses cmp to python3

Random832 random832 at fastmail.com
Sat Apr 9 11:59:30 EDT 2016


On Sat, Apr 9, 2016, at 07:49, Ben Finney wrote:
> I find that a dubious claim.
> 
> The ‘cmp’ implementation must decide *at least* between three
> conditions: less-than, equal-to, greater-than. That is *at least* two
> inflection points.

Yes, but in a sequence it can decide that at each element, and only has
to reach the end of the list in the (relatively rare) case that they're
equal. For that matter, it only has to determine less than vs greater
than for the first unequal element.



More information about the Python-list mailing list