Python object() Function

The object() function in Python returns an empty object, that is the base for all classes. For example:

x = object()

The output will be:

<class 'object'>

Python object() Function Syntax

The syntax of object() function in Python, is:


The function object() does not takes any argument. It returns a featureless object.

Python object() Function Example

Here is an example of object() function in Python. This program uses the dir() function to print all the properties and methods, that are default for all the classes:

x = object()
xpm = dir(x)
for x in xpm:

The snapshot given below shows the sample output produced by this program, demonstrating the object() function in Python:

python object function

Python Online Test

« Previous Function Next Function »

Like/Share Us on Facebook 😋