how to convert code that uses cmp to python3

Ian Kelly ian.g.kelly at gmail.com
Fri Apr 8 00:37:00 EDT 2016


On Apr 7, 2016 10:22 PM, "Marko Rauhamaa" <marko at pacujo.net> wrote:
>
> Ian Kelly <ian.g.kelly at gmail.com>:
>
> > On Thu, Apr 7, 2016 at 1:32 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> >> I use AVL trees to implement timers. You need to be able to insert
> >> elements in a sorted order and remove them quickly.
> >
> > Why would AVL trees implementing timers ever need non-numeric keys
> > though?
> >
> > It seems to me that if you're mixing types like this then the ordering
> > is likely not actually important.
>
> The keys are expiry times. You could use numbers or you could use
> datetime objects.

Yes, but why would you want to use both?

> Ordering is crucial when it comes to timers.

I'm not disputing that.



More information about the Python-list mailing list