etymology of "list comprehension"?

Paul Rubin http
Thu Nov 6 20:02:49 EST 2008


mh at pixar.com writes:
> Ah, thanks... and does "comprehension" have any special computer
> science meaning?

It is from mathematical set theory.  If you write something like

   { p | [some logical expression indicating that p is prime] }

then that denotes a set (the set of all prime numbers).  That every
such formula names a set is called the axiom of comprehension.  The
above notation is sometimes called set-builder notation.

Frege's original system of logic (late 19th century), now called
"naive set theory" had "unrestricted comprehension" which meant
you could say anything at all where the logical expression went.
This made the system inconsistent, because of Russell's paradox
("c is the class of all classes that are not members of themselves.
So is c a member of itself?").  

Axiomatic set theory has a restricted axiom of comprehension that
requires the logical expression to be a first order formula with
a certain syntax, to avoid such paradoxes.

Anyway, list comprehensions in programming languages got their
name because of their resemblance to set-builder notation that
invoked the axiom of comprehension.



More information about the Python-list mailing list