I think it would be useful if iterators on sequences had the __index__
method so that they could be used to slice sequences. I was writing a
class and wanted to return a list iterator to callers.  I then wanted
to let callers slice from an iterator's position, but that isn't
supported without creating a custom iterator class.

Are there reasons for not supporting this generally? I realize not all
iterators would have the __index__ method, but that seems ok.

In Python 3, maybe this could be called a SequenceIterator

-Brad
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to