Alex Martelli wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: <snip> >>Yes, it's a little inconvenient that the builtin heap doesn't take a >>comparison operation but you can easily roll your own heap by transforming >>each item to a (key,item) tuple. Now that I'm thinking about it, it might >>be a good addition to the cookbook. > > > I believe Python 2.5 adds a key= argument to heapq's functions... <snip>
I will revisit the heapq solution when 2.5 is released then. Thanks for the heads up. For the moment I will stay with the list solution that Mike came up with slightly changed to accomodate tips and pointers from others in this thread. -- Lasse Vågsæther Karlsen http://usinglvkblog.blogspot.com/ mailto:[EMAIL PROTECTED] PGP KeyID: 0x2A42A1C2 -- http://mail.python.org/mailman/listinfo/python-list