[Tutor] Iterator Merging

Alan Gauld alan.gauld at btinternet.com
Wed Nov 11 19:25:26 CET 2009


"Kent Johnson" <kent37 at tds.net> wrote 

> > What I'm trying to work out is how to feed the data I have - 6 streams
> > of timestamp, entry into imerge.
>
> merged = imerge(*magpie.logs)
>
> for timestamp, entry in itertools.islice(merged, 3):
>    print timestamp, entry

And stating the obvious, test it with smaller test data first 
or you might wait an awful long time before discovering 
you have a bug! :-)


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list