reseting an iterator

Alan G Isaac aisaac at
Wed May 20 15:29:01 EDT 2009

Jan wrote:
> Wouldn't it be easy for Python to implement generating functions so
> that the iterators they return are equipped with a __reset__() method?

Use ``send``:

Remember, there may be no underlying sequence object for
an iterator, and if you want one in that case, you should build it.

Alan Isaac

More information about the Python-list mailing list