[Python-Dev] accumulator display syntax
Guido van Rossum
guido at python.org
Tue Oct 21 16:55:37 EDT 2003
> Well, calling it an iterator Aussonderungsaxiom would continue emphasizing
> the wrong thing <wink>.
>
> "Set comprehensions" in a programming language originated with SETL,
> and are named in honor of the set-theoretic Axiom of Comprehension
> (Aussonderungsaxiom). In its well-behaved form, that says roughly
> that given a set X, then for any predicate P(x), there exists a
> subset of X whose elements consist of exactly those elements x of X
> for which P(x) is true (in its ill-behaved form, it leads directly
> to Russell's Paradox -- the set of all sets that don't contain
> themselves).
>
> So "comprehension" emphasizes the "if" part of list comprehension
> syntax, which often isn't the most interesting thing. More
> interesting more often are (a) the computation done on the objects
> gotten from the for-iterator, and (b) that the results are generated
> one at a time.
>
> Put that all in a pot and stir, and the name "generator expression"
> seems natural and useful to me. In the Icon language, *all*
> expressions are generators, so maybe I'm biased by that. OTOH, "the
> results are generated one at a time" is close to plain English, and
> "generator expression" then brings to my mind an expression capable
> of delivering a sequence of results.
Thanks for an independent validation of "generator expressions"! It's
a perfect term.
> Or you could call it an Orlijn flourish.
No, that term is already reserved for something else (the details of
which I'll spare you, as they involve intimate details about toddler
hygiene :-).
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list