89DEVs

Python issubclass() function

overview of issubclass()

The issubclass() function checks if a class is a subclass of a given class. The issubclass() function can be used to check built-in classes or user-defined classes.

example of issubclass()

The issubclass() function can be used to check if the first argument is a subclass of the second argument. # example of issubclass result = issubclass(bool, int) print(result) The class bool is a subclass of int and therefore the issubclass() function returns True. True

syntax of issubclass()

The syntax of issubclass() is: issubclass(class, classinfo)

arguments of issubclass()

The issubclass() function accepts two arguments and both are required: The first argument is the class to be checked and the second argument is the class.

return value of issubclass()

The return value of issubclass() is True if the class is a subclass and False if not.

                
        

Summary


Click to jump to section