Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > etymology of "list comprehension"?

Reply
Thread Tools

etymology of "list comprehension"?

 
 
mh@pixar.com
Guest
Posts: n/a
 
      11-06-2008
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
 
Reply With Quote
 
 
 
 
Chris Rebert
Guest
Posts: n/a
 
      11-06-2008
On Thu, Nov 6, 2008 at 1:19 PM, <(E-Mail Removed)> 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?


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
>

 
Reply With Quote
 
 
 
 
mh@pixar.com
Guest
Posts: n/a
 
      11-06-2008
Chris Rebert <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      11-07-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) 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

 
Reply With Quote
 
Paul Rubin
Guest
Posts: n/a
 
      11-07-2008
(E-Mail Removed) 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.
 
Reply With Quote
 
James Harris
Guest
Posts: n/a
 
      11-07-2008
On 6 Nov, 22:13, (E-Mail Removed) wrote:
> Chris Rebert <(E-Mail Removed)> wrote:
> > 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
 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      11-07-2008
Paul Rubin wrote:
> (E-Mail Removed) 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.


Thank you for this info. I suspected something along this line but
could not quite remember.

 
Reply With Quote
 
Martin v. L÷wis
Guest
Posts: n/a
 
      11-07-2008
(E-Mail Removed) wrote:
> Chris Rebert <(E-Mail Removed)> wrote:
>> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Etymology of "Sinister tony cooper Digital Photography 29 01-26-2009 08:22 PM
Etymology of subscript in C ( OT) mdh C Programming 5 09-14-2007 10:06 PM
Etymology of "struct" Francine.Neary@googlemail.com C Programming 20 04-03-2007 07:47 AM
errno, etymology thereof unspammable@gmail.com C++ 3 03-04-2005 01:33 PM
Anybody know the Etymology of the word 'Sprint' as in coding Sprint? Laura Creighton Python 0 09-13-2003 07:39 PM



Advertisments