How about adding slice notation to iterators/generators?
Anh Hai Trinh
anh.hai.trinh at gmail.com
Mon Oct 26 17:51:11 CET 2009
I've written something that is better than you could've imagine.
Get it here: <http://github.com/aht/stream.py>
It works with anything iterable, no need to alter anything.
from itertools import count
from stream import item
c = count()
c >> item[1:10:2]
->[1, 3, 5, 7, 9]
c >> item[:5]
->[10, 11, 12, 13, 14]
There is a ton more you could do with that library, i.e. piping & lazy-
More information about the Python-list