Guido van Rossum wrote:
> 
> I hope there isn't anyone here who believes this patch would be a bad idea?

Not me, but the Iterator protocol docs may need a minor tweak. Currently they 
say this:

"The intention of the protocol is that once an iterator's next() method raises 
StopIteration, it will continue to do so on subsequent calls. Implementations 
that do not obey this property are deemed broken."

This wording is a bit too strong, as it's perfectly acceptable for an object 
to provide other methods which affect the result of subsequent calls to the 
next() method (examples being the seek() and close() methods in the file 
interface).

The current wording does describe the basic intent of the API correctly, but 
you could forgiven for thinking that it ruled out modifying the state of a 
completed iterator in a way that restarts it, or causes it to raise an 
exception other than StopIteration.

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.blogspot.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to