[Python-ideas] iter() on steroids
George Sakkis
gsakkis at rutgers.edu
Fri Apr 13 17:32:41 CEST 2007
On 4/13/07, Jason Orendorff <jason.orendorff at gmail.com> wrote:
> On 4/13/07, George Sakkis <george.sakkis at gmail.com> wrote:
> > f1,f2 = [iter(open(f)).map(str.rstrip) for f in 'foo.txt','bar.txt']
> > for i,line in (f1[:3] + f2[1:5]).filter(None).enumerate():
> > print i,line
>
> George, you've got to pick a better example next time. This one
> is terrifying. :)
I know, but the equivalent using itertools is at least as terrifying :-)
George
More information about the Python-ideas
mailing list