JohnDoDo
JohnDoDo

Reputation: 4900

Python "object" class. Is it just blank or there is something more about it?

I'm trying to find some more information about the Python base class: object but can't find any. Is it just something like class object: pass and doesn't deserve any more attention or...?

Where can I find more about it. What do other classes inherit from it?

Upvotes: 2

Views: 236

Answers (2)

georg
georg

Reputation: 214949

Some basic stuff for other objects to use.

>>> dir(object())
['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', 
'__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 
'__setattr__', '__sizeof__', '__str__', '__subclasshook__']

For more info of what these methods are for check http://docs.python.org/reference/datamodel.html, and here's how they are implemented http://hg.python.org/cpython/file/3d4d52e47431/Objects/object.c.

Upvotes: 2

Eli Bendersky
Eli Bendersky

Reputation: 273386

There's some good info here (and in other articles linked from there). Here's the diagram:

enter image description here

Upvotes: 3

Related Questions