Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106684

Re: how to convert code that uses cmp to python3

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
Newsgroups comp.lang.python
Subject Re: how to convert code that uses cmp to python3
Date Fri, 8 Apr 2016 16:22:07 +0200
Lines 30
Message-ID <mailman.87.1460125333.2253.python-list@python.org> (permalink)
References <57064D0D.1030701@rece.vub.ac.be> <CAPTjJmrGiQS9uhFU-+TQ4nUWQ2p4gmJoQitMotS0Ob--qm1iWg@mail.gmail.com> <5706C961.2000009@rece.vub.ac.be> <CAPTjJmrbL870mV1kU8nHar=bPyKZRmhKP-8iUs_tpYVo5vhhOA@mail.gmail.com> <57075F43.7060004@rece.vub.ac.be> <85fuuw5ypl.fsf@benfinney.id.au> <5707B2CE.1010407@rece.vub.ac.be> <mailman.81.1460122331.2253.python-list@python.org> <87bn5kfbsq.fsf@elektro.pacujo.net> <5707BE8F.9050408@rece.vub.ac.be>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de EnQQwgAiZQXV+BRpYkNScg1F5CUpS+UEBgFEHM/srwsg==
Return-Path <antoon.pardon@rece.vub.ac.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'received:134': 0.05; 'subject:code': 0.07; 'left,': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'seconds.': 0.16; 'subject:python3': 0.16; 'traverse': 0.16; 'comparing': 0.18; 'tree': 0.18; 'delta': 0.22; 'keys': 0.22; 'object.': 0.22; 'decide': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'sequence': 0.27; 'looks': 0.29; 'node': 0.29; 'subject:that': 0.29; 'that.': 0.30; 'code': 0.30; 'received:be': 0.30; 'run': 0.33; 'worked': 0.34; 'list': 0.34; 'follows:': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'doing': 0.38; 'times.': 0.38; 'takes': 0.39; 'to:addr:python.org': 0.40; 'yes': 0.62; 'between': 0.65; 'results.': 0.67; '100': 0.79; 'pardon': 0.84; 'schreef': 0.84
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result ApsQAKO9B1eGuA9G/2dsb2JhbABchFMBM7xGhg0CgX8BAQEBAQFmaA4Bg3IBAQQjVRELGgIFFgsCAgkDAgECAUUTBgICiCOuXY0ohFoBAQgCHnyFJYRLhQuCNIJWAQSYBIFUjDiJK4VijyVig2lqAYYAgzgBAQE
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0
In-Reply-To <87bn5kfbsq.fsf@elektro.pacujo.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <5707BE8F.9050408@rece.vub.ac.be>
X-Mailman-Original-References <57064D0D.1030701@rece.vub.ac.be> <CAPTjJmrGiQS9uhFU-+TQ4nUWQ2p4gmJoQitMotS0Ob--qm1iWg@mail.gmail.com> <5706C961.2000009@rece.vub.ac.be> <CAPTjJmrbL870mV1kU8nHar=bPyKZRmhKP-8iUs_tpYVo5vhhOA@mail.gmail.com> <57075F43.7060004@rece.vub.ac.be> <85fuuw5ypl.fsf@benfinney.id.au> <5707B2CE.1010407@rece.vub.ac.be> <mailman.81.1460122331.2253.python-list@python.org> <87bn5kfbsq.fsf@elektro.pacujo.net>
Xref csiph.com comp.lang.python:106684

Show key headers only | View raw


Op 08-04-16 om 15:52 schreef Marko Rauhamaa:
> Antoon Pardon <antoon.pardon@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.
>
It is the code I run when I traverse a tree
and decide either to go left, right or have
found the node I am looking for.

And yes I have worked with keys like that.

-- 
Antoon

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: how to convert code that uses cmp to python3 Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-04-08 15:31 +0200
  Re: how to convert code that uses cmp to python3 Marko Rauhamaa <marko@pacujo.net> - 2016-04-08 16:52 +0300
    Re: how to convert code that uses cmp to python3 Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-04-08 16:22 +0200

csiph-web