heapq.merge with key=

Kevin D. Smith Kevin.Smith at sas.com
Thu May 7 17:23:31 EDT 2009


I need the behavior of heapq.merge to merge a bunch of results from a 
database.  I was doing this with sorted(itertools.chain(...), key=...), 
but I would prefer to do this with generators.  My issue is that I need 
the key= argument to sort on the correct field in the database.  
heapq.merge doesn't have this argument and I don't understand the code 
enough to know if it's possible to add it.  Is this enhancement 
possible without drastically changing the current code?

-- 
Kevin D. Smith




More information about the Python-list mailing list