Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #106661
| 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-08 09:45 +0200 |
| Message-ID | <mailman.71.1460101559.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> <85wpo95dpo.fsf@benfinney.id.au> <570761B2.3060800@rece.vub.ac.be> |
Op 07-04-16 om 23:08 schreef Ben Finney: > Antoon Pardon <antoon.pardon@rece.vub.ac.be> writes: > >> With this method I have to traverse the two tuples almost always >> twice. Once to find out if they are equal and if not a second time to >> find out which is greater. > You are essentially describing the new internal API of comparison > operators. That's pretty much unavoidable. And nobody thought about this kind of cases or found them important enough? > If you want to avoid repeating an expensive operation – the computation > of the comparison value for an object – you could add an LRU cache to > that function. See ‘functools.lru_cache’. I'll have a look. -- Antoon
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: how to convert code that uses cmp to python3 Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2016-04-08 09:45 +0200
Re: how to convert code that uses cmp to python3 Steven D'Aprano <steve@pearwood.info> - 2016-04-08 22:07 +1000
Re: how to convert code that uses cmp to python3 Marko Rauhamaa <marko@pacujo.net> - 2016-04-08 15:52 +0300
csiph-web