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


Groups > comp.lang.python > #106737

Re: how to convert code that uses cmp to python3

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 2016-04-09 17:24 +0200
Message-ID <mailman.122.1460215489.2253.python-list@python.org> (permalink)
References (10 earlier) <5708C8B0.6050904@rece.vub.ac.be> <85twjb3su5.fsf@benfinney.id.au> <570910E2.3030400@rece.vub.ac.be> <CAPTjJmqeWACzrzka+5kQxO9Co42k7jRJzG_+cCqHkYO2OtQtMw@mail.gmail.com> <57091EA8.4080803@rece.vub.ac.be>

Show all headers | View raw


Op 09-04-16 om 16:41 schreef Chris Angelico:

> 
> In this case, you're likely to end up with large branches of your tree
> that have the same prefix. (And if you don't, your iterations are all
> going to end early anyway, so the comparison is cheap.) A data
> structure that takes this into account will out-perform the naive
> comparison model every time. In fact, a simple dict will probably
> out-perform your tree;

So? I need a structure that can easily give me an answer to the
following: Given key1 and key2 what are the the keys between them
with their corresponding values. As long as a dict can't provide
me with that answer, it doesn't matter that it will out perform
lookups in my trees.

-- 
Antoon Pardon

Back to comp.lang.python | Previous | Next | 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-09 17:24 +0200

csiph-web