Python object() Method

The object() method returns a new featureless object. The object class is the base class of all classes in Python.

object() Syntax:

object()

Parameters:

No parameters.

Return type:

Returns an object of object class.

The following example creates an object.

Example:
obj = object()
print(type(obj))
print(dir(obj)) # list the object attributes
Output
<class 'object'>
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']

object does not have a __dict__, so you can't assign arbitrary attributes to an instance of the object class.