how to convert code that uses cmp to python3

Marko Rauhamaa marko at pacujo.net
Fri Apr 8 09:52:05 EDT 2016


Antoon Pardon <antoon.pardon at rece.vub.ac.be>:
> Well having a list of 1000 Sequence like object. Each sequence
> containing between 1 and 100 numbers. Comparing each sequence
> to each other a 100 times. I get the following results.
>> Doing it as follows:
> seq1 < seq2
> seq2 < seq1
>> takes about 110 seconds.
>> Doing it like this:
> delta = cmp(seq1, seq2)
> delta < 0
> delta > 0
>> takes about 50 seconds.

Looks like a completely artificial scenario.
Marko


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /