"Lasse Vågsæther Karlsen" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > <snip> > > Just added a recipe at > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440673. You can try > > both and see if there's any significant performance difference for your > > data. > <snip> > > Thanks, will take a look at it later. The sort solution seems to work > nicely. Might be a big difference if I have a lot of sources though as I > bet the overhead in doing a sort of N items gets higher than doing a > manipulation of a heap to place an item in the right spot, but with 4-5 > or a few more sources might not make an impact at all.
Unless you're talking about hundreds or thousands sources, it probably won't. I would still go for the heap solution since IMO the resulting code it's more readable and easier to understand. George -- http://mail.python.org/mailman/listinfo/python-list