In Python, all classes are derived from the base class called object
. This means that every object in Python is an instance of a class that ultimately inherits from object
.
The object()
function is a constructor for creating new instances of this base class. It is typically used when you need to create a basic object that does not require any specialized attributes or methods. You cannot add new properties or methods to this object.
Syntax:
object()
copy
The object()
function returns a new object instance.
The dir() function returns all attributes associated with an object.