Origin of the term "first-class object"

Mel Wilson mwilson at the-wire.com
Tue Nov 18 10:07:10 EST 2003


In article <slrnbrjijj.105.bignose-hates-spam at rose.localdomain.fake>,
Ben Finney <bignose-hates-spam at and-benfinney-does-too.id.au> wrote:
>On Tue, 18 Nov 2003 03:01:35 GMT, Rainer Deyke wrote:
>> John Roth wrote:
>>> I can't think of anything I can't do with a name that I might want
>>> to.
>>
>> One would be passing a name as an argument
>> to a function.
>
>To accomplish what?  What would you be doing with the name that you
>can't do just as easily by passing the object (by reference, as always
>happens in Python)?

   That's rather beside the point, isn't it?  People
continually come to c.l.p asking how to get the names of
function parameters.  Some are trying to write diagnostic
routines.  Some people want to know how to make data names
out of user input strings; we tell them to for heaven's sake
use a dictionary.

   It's not unreasonable to give names as an example of
second-class objects in Python.

   And a good thing, as you and I think.  Names are
first-class in natural human languages, and look what
happens:

     "...The name of the song is called 'Haddocks'
   Eyes'."

     "Oh, that's the name of the song, is it?"  Alice
   said, trying to feel interested.

     "No, you don't understand," the Knight said,
   looking a little vexed.  "That's what the name is
   _called_.  The name really is 'The Aged Aged Man'."

     "Then I ought to have said 'That's what the song is
   called'?"  Alice corrected herself.

     "No, you oughtn't!  That's quite another thing!
   The song is called 'Ways and Means':  but that's only
   what it's called, you know."

     "Well, what is the song then?" said Alice, who was
   by this time completely bewildered.

     "I was coming to that," the Knight said.  "The song
   really is 'A-sitting on a Gate', and the tune's my
   own invention."

                        _Through the Looking Glass_, of course
                        Lewis Carroll

        Regards.        Mel.




More information about the Python-list mailing list