Greg Kochanski <g...@kochanski.org> added the comment:

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.

----------

_______________________________________
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

Reply via email to