Generator naming convention?
Diez B. Roggisch
deets at nospam.web.de
Wed Jun 28 22:10:47 CEST 2006
aurora00 at gmail.com schrieb:
> I use generators a lot. E.g.
> def gen_words(text)
> ... parse text ...
> yield each word in text
> for word in gen_words(text):
> print word
> I don't like the name gen_xxx() very much. Looking for some inspiration
> to name generators. Here are some of my ideas:
> Any idea? Do you have a naming convention for generators?
No. From my POV, a generator is not different from any other method
returning a list. I don't care if the implementation is
return ["dies", "ist", "das", "Haus", "vom", "Nikolaus"]
for w in ["dies", "ist", "das", "Haus", "vom", "Nikolaus"]:
More information about the Python-list