Greg Kochanski <g...@kochanski.org> added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11248> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com