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


Groups > comp.lang.python > #106745

Re: how to convert code that uses cmp to python3

From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: how to convert code that uses cmp to python3
Date 2016-04-09 19:32 +0300
Organization A noiseless patient Spider
Message-ID <87y48meo93.fsf@elektro.pacujo.net> (permalink)
References (13 earlier) <CAPTjJmqeWACzrzka+5kQxO9Co42k7jRJzG_+cCqHkYO2OtQtMw@mail.gmail.com> <57091EA8.4080803@rece.vub.ac.be> <CAPTjJmrS=HW2fhDgZw22n5kcS4c+=b71rV50DkPPkKRdRW+QqA@mail.gmail.com> <570927E4.9000104@rece.vub.ac.be> <mailman.128.1460217831.2253.python-list@python.org>

Show all headers | View raw


Antoon Pardon <antoon.pardon@rece.vub.ac.be>:

> And when I need some personal object as a key, I can avoid the
> duplication by using some kind of cmp cache when I implement __lt__
> and family.

Yes, that's what you can do in rare, extreme cases where key comparison
takes a long time. For caching, you will simply need to require that
keys stay immutable wrt comparing.


Marko

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-09 18:03 +0200
  Re: how to convert code that uses cmp to python3 Marko Rauhamaa <marko@pacujo.net> - 2016-04-09 19:32 +0300

csiph-web