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 gpk-kochanski
Recipients daniel.urban, docs@python, eric.araujo, ezio.melotti, georg.brandl, gpk-kochanski, rhettinger
Date 2011-02-20.01:41:43
SpamBayes Score 8.322817e-09
Marked as misclassified No
Message-id <1298166104.1.0.316331314972.issue11248@psf.upfronthosting.co.za>
In-reply-to
Content
The code (bug312.py) was not submitted as a "pattern", but rather as an example of a trap into which it is easy to fall, at least for the 99% of programmers who are users of the language rather than its implementers.  


The basic difference is that while one can write a function that is guaranteed to execute to the end of its body[*]; one cannot do that with a generator function.   This point ought to be made in the documentation.
[* Neglecting SIGKILL and perhaps a few abnormal cases.]

The current documentation emphasizes the analogy to functions (which can be misleading) and (in section 6.8) explictly says that the normal behaviour of a generator function is to run all the way to completion.
History
Date User Action Args
2011-02-20 01:41:44gpk-kochanskisetrecipients: + gpk-kochanski, georg.brandl, rhettinger, ezio.melotti, eric.araujo, daniel.urban, docs@python
2011-02-20 01:41:44gpk-kochanskisetmessageid: <1298166104.1.0.316331314972.issue11248@psf.upfronthosting.co.za>
2011-02-20 01:41:43gpk-kochanskilinkissue11248 messages
2011-02-20 01:41:43gpk-kochanskicreate