Why 'class spam(object)' instead of class spam(Object)' ?
Colin J. Williams
cjw at sympatico.ca
Mon Sep 17 20:57:20 EDT 2007
Steve Holden wrote:
> Carl Banks wrote:
>> On Fri, 07 Sep 2007 01:30:00 -0500, Sergio Correia wrote:
>>> Hi, I'm kinda new to Python (that means, I'm a total noob here), but
>>> have one doubt which is more about consistency that anything else.
>>>
>>> Why if PEP 8 says that "Almost without exception, class names use the
>>> CapWords convention", does the most basic class, object, is lowercase?
>> It said "almost". :)
>>
> Indeed it did, and never forget that most of PEP 8 was derived from an
> essay by Guido whose original title was "A Foolish Consistency is the
> Hobgoblin of Little Minds" ...
>>> I found a thread about this:
>>> http://mail.python.org/pipermail/python-list/2007-April/437365.html
>>> where its stated that -object- is actually a type, not a class; but the
>>> idea still doesn't convince me.
> You don't have to be convinced. You just have to do what the PEP says
> yourself and ignore the people who *haven't* done what it says
> (particularly if they are core Python developers).
>
>> There's a false dichotomy there: it's not an either-or situation. Almost
>> everyone would agree that new-style classes, defined by the Python class
>> statement, are both classes and types. Some might squabble over whether
>> object is class, but it has nothing to do with why object is spelled in
>> lower-case.
>>
>> The reason why "object" is lower case is because built-in types are
>> spelled in lower-case. Why are built-in types lower case? Because many
>> built-in types were originially functions. For example, "int" and "str"
>> were once functions. When these symbols became the names of their
>> respective types, they kept the lower-case spelling, and it became
>> convention for built-in types to be spelled lower-case.
>>
> In other words: "Get over it" ;-)
>
> regards
> Steve
Surely Python 3000 gives the opportunity to introduce some consistency.
Does the user care whether an object is implemented in C?
Colin W.
More information about the Python-list
mailing list