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 terry.reedy
Recipients Peter.Norvig, docs@python, ezio.melotti, r.david.murray, rhettinger, terry.reedy
Date 2012-05-18.20:50:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1337374240.46.0.172716158034.issue14845@psf.upfronthosting.co.za>
In-reply-to
Content
It has been noted elsewhere (but I cannot find it) that 1) an uncaught StopIteration raised in an expression *within* a genexp is indistinguishable from the StopIteration raised *by* the genexp upon normal termination; and 2) this makes genexps different from otherwise equivalent comprehensions. The statement in PEP289 does not address this exceptional case.

Raymond, do you want to revise your PEP to mention this?

PEPs are, as their name says, proposals that express intention, not result, and especially not the result after continued patching. We do not usually usually go back and revise PEPs after they have been implemented. It would be an endless task. Hence, they are not current 'documentation' unless unless specifically referred from the docs. This one is not so referenced.

Perhaps PEP 0 should say that " Finished PEPs (done, implemented in code repository)" are historical documents and not current documentation.

I checked the entries for comprehensions and generator expressions and they do not claim equivalence, but do (briefly) describe the actual behavior. However, it is easy to miss that the entry in 5.2.8. Generator expressions implies the two facts above. Perhaps we should explicitly say something like:

If *expression* raises StopIteration, it will not be distinguished from the StopIteration raised upon normal termination of the generator, and it will make the generator expression act differently from the otherwise equivalent comprehension.
History
Date User Action Args
2012-05-18 20:50:40terry.reedysetrecipients: + terry.reedy, rhettinger, ezio.melotti, r.david.murray, docs@python, Peter.Norvig
2012-05-18 20:50:40terry.reedysetmessageid: <1337374240.46.0.172716158034.issue14845@psf.upfronthosting.co.za>
2012-05-18 20:50:39terry.reedylinkissue14845 messages
2012-05-18 20:50:39terry.reedycreate