The syntax of object():
o = object()
The object() doesn't accept any parameters.
The object() function returns a featureless object.
test = object() print(type(test)) print(dir(test))
When you run the program, the output will be:
<class 'object'> ['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
Here, an object test of class 'object' is created.
In the program, we used built-in functions type() and dir() to get type and all attributes of the object respectively.
The object doesn't have __dict__ as suggested by the output. Hence, you can't assign arbitrary attributes to the instances of this class.
__dict__