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 eric.araujo, ezio.melotti, georg.brandl, gpk-kochanski
Date 2011-02-19.17:51:27
SpamBayes Score 7.454722e-07
Marked as misclassified No
Message-id <1298137890.92.0.757774767154.issue11248@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, the current behaviour makes sense from a language designer's viewpoint, and maybe even from the user's viewpoint (if the user thinks about it a carefully).

But, that's not the point of a computer language.   The whole reason we program in languages like python instead of asm is to match the behaviour of the silicon to human capabilities and expectations.   So, documentation needs to go beyond the minimum from which an expert could deduce the system behaviour.  It needs to point out unexpected things that a competent programmer might miss, even if they could potentially have deduced that unexpected behaviour.

The trouble here is that the syntax of a generator is so much like a function that it's easy to think of it as being as safe and simple as a function.  It's not: the "yield" statement lets a lot of external complexity leak in that's not relevant to a function (unless you're writing multithreaded code).  So, the documentation needs to help the user avoid such problems.
History
Date User Action Args
2011-02-19 17:51:30gpk-kochanskisetrecipients: + gpk-kochanski, georg.brandl, ezio.melotti, eric.araujo
2011-02-19 17:51:30gpk-kochanskisetmessageid: <1298137890.92.0.757774767154.issue11248@psf.upfronthosting.co.za>
2011-02-19 17:51:27gpk-kochanskilinkissue11248 messages
2011-02-19 17:51:27gpk-kochanskicreate