How to make an empty generator?

Aahz aahz at pythoncraft.com
Wed Feb 24 23:58:17 CET 2010


In article <mailman.2802.1266607542.28905.python-list at python.org>,
Terry Reedy  <tjreedy at udel.edu> wrote:
>
>Confusing generators and generator functions is, well, confusing.
>For future reference, and clarity of communication in Pythonland,
>
>generator function: function that produces a generator when called; if 
>python coded, its body contains 'yield'.
>
>generator: iterator produced by a generator function; has .__next__ and 
>self-returning .__init__, like all other iterators.
>
>generator expression: an expression that evaluates to a generator; the 
>expression is used to create a temporary anonymous generator function 
>that is called to produce the generator and is then discarded.

My preference is to use the terms "generator" and "generator iterator"
(abbreviated "gen iter" or "geniter").
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer



More information about the Python-list mailing list