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.

ExampleEdit & Run
print(issubclass(int, object))
print(isinstance(list, object))
print(isinstance(dict, object))
class MyClass:
    pass
print(isinstance(MyClass, object))
copy
Output:
True True True True [Finished in 0.010933203622698784s]

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.

ExampleEdit & Run
obj = object()
print(obj)
print(type(obj))
print(dir(obj))
copy
Output:
<object object at 0x7f7a65e40190> <class 'object'> ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__'] [Finished in 0.009971408173441887s]

The dir() function returns all attributes associated with an object.