PEP 255: Simple Generators
balexander at rsv.ricoh.com
Wed Jun 20 21:00:00 CEST 2001
Here are $.02 from an old Icon hacker. I've been close to the center of Icon development and evolution for over 15 years, and here are some observations
1. As previously pointed out in these threads, Icon makes no syntactic distinction between a "generating" function and an "ordinary" function that
returns a single value.
2. As an Icon programmer, it never occurred to me that there was a need for a syntactic distinction.
3. I don't recall any Icon users ever raising the issue that having such a distinction would improve the language.
At some level of theoretical reasoning, it might seem that distinguishing between generator functions and other functions would be helpful. However, in
real programming life it doesn't seem to matter.
I support Tim's position to keep Python's syntax simple!
BTW, in the comments that precede a function definition (or in a docstring), I almost always mention something about what the function returns. That is a
great place to communicate to callers and maintainers that it is a generator.
More information about the Python-list