[Python-Dev] PEP 289: Generator Expressions

Guido van Rossum guido at python.org
Mon Oct 27 19:50:30 EST 2003


> > The one persistent (but low-as-a-whisper) grumbling is by one
> > A.M., who keeps mumbling "they're _iterator_ expressions, the fact
> > that they use generators is an implementation detail, grmbl
> > grmbl":-).
> 
> I'm inclined to agree with him.  Was there some reason why the term
> iterator expressions was rejected?

After seeing "iterator expressions" I came up wit "generator
expressions" and decided I liked that better.  Around the same time
Tim Peters wrote a post where he proposed "generator expressions"
independently:

http://mail.python.org/pipermail/python-dev/2003-October/039186.html

Trying to rationalize my own gut preference, I think I like "generator
expressions" better than "iterator expressions" because there are so
many other expressions that yield iterators (e.g. iter(x) comes to
mind :-).  Just like generator functions are one specific cool way of
creating an iterator, generator expressions are another specific cool
way, and as a bonus, they're related in terms of implementation (and
that certainly reflects on corners of the semantics, so I don't think
we should try to hide this as an implementation detail).

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list