Generator naming convention?

aurora00 at gmail.com aurora00 at gmail.com
Wed Jun 28 20:52:00 CEST 2006


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:

  enumerate_words
  gen_words
  generate_words
  parse_words
  walk_words

Any idea? Do you have a naming convention for generators?

wy




More information about the Python-list mailing list