how to convert code that uses cmp to python3

Chris Angelico rosuav at gmail.com
Fri Apr 8 03:40:08 EDT 2016


On Fri, Apr 8, 2016 at 5:35 PM, Antoon Pardon
<antoon.pardon at rece.vub.ac.be> wrote:
> Op 08-04-16 om 00:21 schreef Chris Angelico:
>> On Fri, Apr 8, 2016 at 6:56 AM, Antoon Pardon
>> <antoon.pardon at rece.vub.ac.be> wrote:
>>> That solution will mean I will have to do about 100% more comparisons
>>> than previously.
>> Try it regardless. You'll probably find that performance is fine.
>> Don't prematurely optimize!
>>
>> ChrisA
>
> But it was already working and optimized. The python3 approach forces
> me to make changes to working code and make the performance worse.

Is performance actually worse because you're doing two comparisons?
Visibly worse? If so, you probably have an overly-complex comparison
function, and a tree is *always* going to be suboptimal. Have you
actually measured a performance hit?

ChrisA



More information about the Python-list mailing list