PEP 318
Skip Montanaro
skip at pobox.com
Tue Mar 23 10:24:02 EST 2004
Isaac> I disagree. It's not just the compile which has to search for
Isaac> that yield keyword, we human being reading other's uncommented
Isaac> code (or mis-commented code) also has to do the same. It would
Isaac> do much good if the completely different call convention of
Isaac> generator is made much more explicit in the definition of the
Isaac> function.
You'll be free to write your generator functions like so:
def generator(f):
return f
def silly_counter(n) [generator]:
for i in range(10):
yield n+i
It will just be a convention you adopt though, not a language rule.
Skip
More information about the Python-list
mailing list