This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Günter Rote
Recipients Günter Rote, docs@python
Date 2017-08-09.09:49:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502272159.56.0.437301068833.issue31156@psf.upfronthosting.co.za>
In-reply-to
Content
It should be mentioned in the documentation that 

A StopIteration exception raised in the body of a while loop will terminate (and is caught by) the while-loop, thus leading to graceful termination.

A good place would be here:
1) https://docs.python.org/3/reference/compound_stmts.html#the-while-statement

I don't know how such a StopIteration termination of a while loop
affects the else-clause. This should be clarified.

Here:
2) https://docs.python.org/3/library/exceptions.html#StopIteration
it would be good to explicitly state:

An enclosing while-loop or for-loop acts like an implicit catch for StopIteration. The StopIteration exception will terminate the loop.

(I guess, a for-loop is also just terminated when the StopIteration originates in the BODY of the loop, although this is not the typical case.)
History
Date User Action Args
2017-08-09 09:49:19Günter Rotesetrecipients: + Günter Rote, docs@python
2017-08-09 09:49:19Günter Rotesetmessageid: <1502272159.56.0.437301068833.issue31156@psf.upfronthosting.co.za>
2017-08-09 09:49:19Günter Rotelinkissue31156 messages
2017-08-09 09:49:19Günter Rotecreate