itertools comments [Was: Re: RELEASED: Python 2.3a2]

Alexander Schmolck a.schmolck at gmx.net
Fri Feb 21 10:31:14 EST 2003


Alexander Schmolck <a.schmolck at gmx.net> writes:
> 
> Admittedly, you could already express this common case:
> 
>   xwindow(l)
> 
> using only 2 of your itertools:
> 
>   izip(l, islice(l,1))

Ooops, I guess that would need to be:

    izip(l, islice(l,1,None))

The nongenerator version is:

   zip(l, l[1:])

Maybe a 'drop'/'take' as in 

    izip(l, drop(1,l))

would be handy, too?

alex




More information about the Python-list mailing list