Re: [Python-ideas] Proto-PEP on a 'yield from' statement

Mike Meyer wrote:
I'm not sure what I should add. The PEP is written on the assumption that the reader understands how iterators and generators currently work, including StopIteration. Given that, I think it ought to be fairly clear how StopIteration is being used in the proposal. It's not much different from what you would do if you wanted to iterate over an iterator manually, without using a for-loop: try: while 1: x = myiter.next() ... except StopIteration: pass The only difference is that instead of ignoring the StopIteration instance itself, we use it to carry the return value of the generator. I don't think the PEP is the right place to put tutorial information about the current StopIteration mechanism. -- Greg
participants (1)
-
Greg Ewing