Why 'class spam(object)' instead of class spam(Object)' ?

Steve Holden steve at holdenweb.com
Fri Sep 7 19:25:32 CEST 2007


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
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------




More information about the Python-list mailing list