Javatpoint Logo
Javatpoint Logo

Python object() Function

The python object() returns an empty object. It is a base for all the classes and holds the built in properties and methods which are default for all the classes.



It returns an empty object.

Python object() Function Example 1

The below example shows the working of object().


<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__']

Explanation: In the above example, an object test of class 'object' is created.

We used the built-in functions named as type() and dir() to get type and all attributes of the object respectively.

The object does not have __dict__ as suggested by the output. Hence, you cannot assign arbitrary attributes to the instances of this class.

Next TopicPython Functions

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA