Inheriting Object

Ian Kelly ian.g.kelly at gmail.com
Fri May 20 02:53:57 EDT 2011


On Thu, May 19, 2011 at 10:11 PM, Navkirat Singh <n4vpython at gmail.com> wrote:
> Thanks Guys...I will look deeper into this. I thought I read somewhere that
> it was required in older python releases, but in newer releases it is not. I
> might be wrong though.

In Python 3.x all classes inherit from object by default, so "class
Foo(object):" and "class Foo:" are equivalent.  In Python 2.x they are
not equivalent, and you should use "class Foo(object):" unless you
have a specific reason not to.

Cheers,
Ian



More information about the Python-list mailing list