On Sun, Jul 13, 2008 at 4:16 PM, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: >> I understand that heapq is not that efficient to implement timeouts as >> I thought at first. >> It would have been perfect if there were functions to remove arbitrary >> elements withouth needing to re-heapify() the heap every time. >> > There could be suitable functions, but there aren't any. > ... > Bottom line though is that heaps aren't really suitable for timeouts.
I would argue that heaps in general are ideally suited for timeouts; it's just that the Python heapq implementation is lacking if you ever need to cancel a timeout before it expires. -Miles -- http://mail.python.org/mailman/listinfo/python-list