By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,519 Members | 1,831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,519 IT Pros & Developers. It's quick & easy.

etymology of "list comprehension"?

P: n/a
mh
I googled and wiki'ed, but couldn't find a concise clear answer
as to how python "list comprehensions" got their name.

Who picked the name? What was the direct inspiration, another
language? What language was the first to have such a construct?

I get that it's based on set notation.

Thanks!
Mark

--
Mark Harrison
Pixar Animation Studios
Nov 6 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Thu, Nov 6, 2008 at 1:19 PM, <mh@pixar.comwrote:
I googled and wiki'ed, but couldn't find a concise clear answer
as to how python "list comprehensions" got their name.

Who picked the name? What was the direct inspiration, another
language? What language was the first to have such a construct?
According to Wikipedia, the SETL programming language was the first
one to have such a construct. My understanding is that Python took the
idea from Haskell, where the concept has the same name. The term
"comprehension" for the concept was first used in the NPL programming
language (Wikipedia again).

Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
>
I get that it's based on set notation.

Thanks!
Mark

--
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list
Nov 6 '08 #2

P: n/a
mh
Chris Rebert <cl*@rebertia.comwrote:
the term
"comprehension" for the concept was first used in the NPL programming
language (Wikipedia again).
Ah, thanks... and does "comprehension" have any special computer
science meaning?

--
Mark Harrison
Pixar Animation Studios
Nov 6 '08 #3

P: n/a
mh@pixar.com wrote:
I googled and wiki'ed, but couldn't find a concise clear answer
as to how python "list comprehensions" got their name.

Who picked the name? What was the direct inspiration, another
language? What language was the first to have such a construct?

I get that it's based on set notation.
The etymology of 'com-prehend' is with-grab, where prehend comes from
the same Latin verb as prehensile (able to grab). A set comprehension
(which has also been called things like 'set-builder notation') includes
or grabs the whole set in one expression, instead of listing members
one-by-one.

tjr

Nov 7 '08 #4

P: n/a
On 6 Nov, 22:13, m...@pixar.com wrote:
Chris Rebert <c...@rebertia.comwrote:
the term
"comprehension" for the concept was first used in the NPL programming
language (Wikipedia again).

Ah, thanks... and does "comprehension" have any special computer
science meaning?
Good question. It seems that comprehension in this case relates to
comprehensiveness - i.e. a note of how complete a set is. From the
list at

http://www.onelook.com/?w=comprehension&ls=a

check out in particular Merriam-Webster meanings 2a and 2b, and
Wikipedia for comprehension (logic).

--
HTH,
James
Nov 7 '08 #5

P: n/a
mh@pixar.com wrote:
Chris Rebert <cl*@rebertia.comwrote:
>the term
"comprehension" for the concept was first used in the NPL programming
language (Wikipedia again).

Ah, thanks... and does "comprehension" have any special computer
science meaning?
Paul already explained the maths, but I find that the etymology remains
unclear still. In any case, the Wikipedia article
Axiom_schema_of_specification says that the following names are used
for this axiom:
- axiom schema of specification,
- axiom schema of separation,
- subset axiom scheme or
- axiom schema of restricted comprehension

I think the "comprehension" definition goes back to this definition from
logic:

# In logic, the comprehension of an object is the totality of
# intensions, that is, attributes, characters, marks, properties, or
# qualities, that the object possesses, or else the totality of
# intensions that are pertinent to the context of a given discussion.

So you get an "intensional" definition of a set: give me all object
with a certain comprehension - as opposed to "extensional" definition,
such as "the set of all capitals consists of Paris, London, Berlin,
Madrid, ..."

The definition in logic, in turn, matches my understanding of the
English word "to comprehend": If I know all attributes, marks,
etc of an object, I understand it fully, i.e. I comprehend it.

Regards,
Martin
Nov 7 '08 #6

P: n/a
mh
"Martin v. Lowis" <ma****@v.loewis.dewrote:
The definition in logic, in turn, matches my understanding of the
English word "to comprehend": If I know all attributes, marks,
etc of an object, I understand it fully, i.e. I comprehend it.
I think also that as was pointed out, "comprehension" meaning
"comprehensive" also makes sense, e.g.

a comprehensive definition of positive odd numbers:

{ x | x = 2k+1, for all integers k >= 0 }

as opposed to

{ 1, 3, 5, ... }
Thanks everybody, I feel much better informed now!

--
Mark Harrison
Pixar Animation Studios
Nov 7 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.