itertools.islice and slice objects

Raymond Hettinger vze4rx4y at verizon.net
Wed Nov 24 16:46:09 CET 2004


[Steven Bethard]
> Is there a reason that itertools.islice doesn't support None arguments
> for start and step?  This would be handy for use with slice objects

Offhand, this seems like a reasonable idea.  Please file a Py2.5 feature request
and assign to me.


> Of course, I can get (start, stop, step) tuples with slice.indices, but
> only if I know the length of the iterable, which kinda defeats the
> purpose of using itertools...

The main purpose is to extract elements one at time instead of all at once.
This memory friendly approach results in better scalability.


Raymond Hettinger





More information about the Python-list mailing list