How to define an empty class in python

Last updated 1 week, 6 days ago | 37 views 75     5

Tags:- Python

Python | Create an empty class

In python, it required adding a pass statement to define an empty class. The pass is a special statement in python that does nothing. It just works as a dummy statement.


This is an example of how to define an empty class in python. 

class A:

# define object
obj = A()

# set an attribute of the object for the empty class
obj.title = 'Empty Class'

Output for the above code

===================== RESTART: E:\py\ =====================
<__main__.A object at 0x000002B88AEA4788>
Empty Class