Search code examples
pythonclassobject

'object' class documentation in python


I can't find the documentation of the 'object' class in python, which is the root of the inheritance tree of all classes in python. what I have tried: googling the terms shows pages and pages of results regarding object oriented programming in python. where can I get the documentation?


Solution

  • Remember that object is a class, and like all other classes you can get two useful things.

    • help
    • dir

    Try this:

    >>> help(object) # Will give you some information about the methods implemented
    >>> dir(object) # Will give you the attributes list
    

    Do you want the exact source code? Builtins.pyi

    I think object was implemented at interpreter-level, but in the file builtins.pyi you can find something useful too.