Distinguishing active generators from exhausted ones

Terry Reedy tjreedy at udel.edu
Mon Jul 27 02:10:00 CEST 2009


Michal Kwiatkowski wrote:

> The thing is I don't need the next item. I need to know if the
> generator has stopped without invoking it.

Write a one-ahead iterator class, which I have posted before, that sets 
.exhausted to True when next fails.

tjr




More information about the Python-list mailing list