views:

320

answers:

3

No flaming please, asking as a community wiki so nobody gets reputation here. I know python is not the first language to have list comprehension. I'm just interest in the history of the name.

I'm particularly interested in why it's called comprehension

+1  A: 

The history section of the wikipedia page discusses a little on where it came from. List_comprehension#History

Brandon Bodnár
But it doesn't say why
Vinko Vrsalovic
This is a programming site! bodnarbm is doing the right thing in maximising re-use through composition to the wikipedia article. Or something.
Joe
And strictly speaking the answer to "why list comprehension is called so in python?" is "because that's what it's called in other languages".
Joe
But why was it called so in other languages and not, say list "generator" or something else? Comprehension sounds weird
Davide
+7  A: 

The name comes from the concept of a set-comprehension

Comprehension is used here to mean complete inclusion or complete description. A set-comprehension is a (usually short) complete description of a set, not an exhaustive (and possibly infinite) enumeration.

Kevin Little
But why set comprehension was called so?
Davide
"comprehension" is used here to mean "complete inclusion" or "complete description". A set-comprehension is a (usually short) complete description of a set, not an exhaustive (and possibly infinite) enumeration. The set comprehension "{x∈N:x>2}" is the infinite set of all natural numbers greater than 2. (By convention, a capital 'N' is defined to mean the set of natural numbers, '∈' means "is of the set", ':' means "such that", and the '{}' mean "set".)
Kevin Little
And now, Python has generalized the list comprehension syntax to sets!
dan04
+1  A: 

Because it's a very comprehensive way to describe a sequence (a set in math and other languages, and a list/sequence in Python).

ΤΖΩΤΖΙΟΥ