On Sat, Aug 16, 2014 at 3:17 PM, Jonas Wielicki
On 16.08.2014 23:46, Neil Girdhar wrote:
I'm sure this has been suggested before, but I just spent two days trying to figure out why a method wasn't being called only to find that I'd accidentally pasted a yield into the function. What is the argument against a different keyword for introducing generator functions/methods?
If it's backward compatibility, then my suggestion to have a from __future__ and then make it real in Python 4.
For what it’s worth, I know this problem very well, and it can take hours to figure out whats wrong.
A linter should be able to figure this out. For example, mypy will insist that a generator has a return type of Iterable[...]. So maybe you won't have to wait for Python 4; if the mypy proposal goes forward you will be able to use type annotations to distinguish generators. -- --Guido van Rossum (python.org/~guido)