Merging sorted lists/iterators/generators into one stream of values...

Lasse Vågsæther Karlsen lassevk at gmail.com
Fri Oct 7 15:36:36 CEST 2005


Thanks, that looks like Mike's solution except that it uses the
built-in heapq module.

While this one contains less code than Mike's solution it seems to lack
the ability to control the comparison operation, which means it won't
work in my case. I need to both be able to sort on an arbitrary field
name (could be done using a list where I place the field first), and
also to be able to sort in a different order than smallest-first.

Perhaps by adjusting the data that is returned through each source
would do that. I'll look into it.




More information about the Python-list mailing list