Python issubclass() Function Tutorial

In this section, we will learn what the issubclass() function is and how to use it in Python.

What is Python issubclass() Function?

The Python issubclass() function is used to see if a class is the sub-class (child) of another class or not.

Python issubclass() Function Syntax:

issubclass(ChildClass, ParentClass)

issubclass() Function Parameters:

The function takes two arguments:

  • The first argument is the class that we want to see if it’s the child class of another class.
  • The second argument is the class that we want to see if it’s the parent of the first argument (which is a class).

issubclass() Function Return Value:

The return value of this function is of type boolean.

The value will be True if the first argument is the child of the second argument.

Otherwise the value False will return instead.

Example: using issubclass() function in Python

class Parent: 
    pass


class Child (Parent):
    pass

res = issubclass(Child, Parent)

print(res)

Output:

True
Facebook
Twitter
Pinterest
LinkedIn

Top Technologies