a few extensions for the itertools
Duncan Booth
duncan.booth at invalid.invalid
Mon Nov 20 03:25:06 EST 2006
Mathias Panzenboeck <e0427417 at student.tuwien.ac.at> wrote:
> take(n,iterable) -> iterator
> returns a iterator over the first n
> elements of the iterator
Isn't this just the same as itertools.islice(iterable, n) ?
> drop(n,iterable) -> iterable
> drops the first n elemetns of iterable and
> return a iterator over the rest
and this looks to be the same as itertools.islice(iterable, n, None)
Can you give use cases for 'heads' and 'tails'? I'm curious why you would
want them.
More information about the Python-list
mailing list