Trying to understand Python objects

Aahz aahz at pythoncraft.com
Thu Nov 23 16:19:47 CET 2006


In article <mailman.564.1164158130.32031.python-list at python.org>,
Ben Finney  <bignose+hates-spam at benfinney.id.au> wrote:
>
>Typically, classes are created as a subclass of another class. The
>top-level basic type in Python is 'object', so if your class doesn't
>make sense deriving from anything else, derive from 'object'.
>
>    class Point(object):
>        pass
>
>Defining a class with *no* superclass is not recommended. If you don't
>yet understand the difference between the above style (called a
>"new-style" class) and the style you presented, you should always
>derive from a superclass ('object' or something more specific) until
>you encounter a situation where that causes a problem.

Side note: I disagree with the above advice, but it's Thanksgiving and I
don't have enough room on the margin for the proof.  I think classic
classes are just fine.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles:  boring syntax, unsurprising semantics,
few automatic coercions, etc etc.  But that's one of the things I like
about it."  --Tim Peters on Python, 16 Sep 1993



More information about the Python-list mailing list