possibly trivial newbie list/array question
Tim Peters
tim.one at home.com
Fri Aug 24 00:31:38 EDT 2001
[Paul Rubin]
> Can you tell me the actual purpose of list comprehension?
>
> [f(x) for x in a]
Maximal clarity in common cases. See design docs for the Haskell language,
from which Python most directly borrowed this feature; Haskell in turn
adapted it from the SETL language; SETL in turn adapted the notation from
set theory; the name "comprehension" comes from the set-theoretic so-called
Axiom of Comprehension, more directly relevant to forms with an "if" clause.
More information about the Python-list
mailing list