PEP 255: Simple Generators

Roman Suzi rnd at onego.ru
Sat Jun 23 17:12:13 CEST 2001


Maybe we can define generators like this, for example:

def f(x):
  f.is_generator = 1
  for i in x:
    yield k

Here we explicitely tell that we want "function" to be a generator!

(If we forget to do it, then it will be equivalent to:

def f(x):
  ### f.is_generator = 1
  for i in x:
    yield.append(k)
  return yield

)

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Saturday, June 23, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "He's not dead, Jim, he's just metabolically challenged." _/





More information about the Python-list mailing list