generic xmerge ?

2005-10-17 Thread [EMAIL PROTECTED]
Hi, I was reading this recipe and am wondering if there is a generic version of it floating around ? My list is a tuple (date, v1, v2, v3) and I would like it to sort on date. The documentation doesn't mention how the items are compared and the example only use integers.

Re: generic xmerge ?

2005-10-17 Thread Alex Martelli
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I was reading this recipe and am wondering if there is a generic version of it floating around ? My list is a tuple (date, v1, v2, v3) and I would like it to sort on date. The documentation doesn't mention how the items are compared and the

Re: generic xmerge ?

2005-10-17 Thread [EMAIL PROTECTED]
oops, sorry. I meant l1=[(date,v1,v2,v3), ...] l2=[ another set of tuples ] Thanks. so I have to concat the multiple lists first(all of them are sorted already) ? Alex Martelli wrote: I'm not sure what my list is a tuple mean (list and tuple being different types) nor what this has to do

Re: generic xmerge ?

2005-10-17 Thread Alex Martelli
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: oops, sorry. I meant l1=[(date,v1,v2,v3), ...] l2=[ another set of tuples ] Thanks. so I have to concat the multiple lists first(all of them are sorted already) ? You can do it either way -- simplest, and pretty fast, is to concatenate them all

Re: generic xmerge ?

2005-10-17 Thread [EMAIL PROTECTED]
million thanks. So the default compare funcion of heapq also do it like sort ? The size of the list is not very large but has the potential of being run many times(web apps). So I believe second one should be faster(from the app perspective) as it goes into the optimized code quickly without all