how to convert code that uses cmp to python3
Marko Rauhamaa
marko at pacujo.net
Sat Apr 9 12:32:56 EDT 2016
Antoon Pardon <antoon.pardon at 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
More information about the Python-list
mailing list