Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python issubclass() Function

Python issubclass() Function

Python built-in function Python built-in function


Description

issubclass() The method determines whether the parameter class is a subclass of the type parameter classinfo.

Syntax

The following is the syntax of the issubclass() method:


issubclass(class, classinfo)

Parameters

Return Value

Returns True if class is a subclass of classinfo, otherwise returns False.


Example

The following examples demonstrate the use of the issubclass function:

#!/usr/bin/python

-- coding: UTF-8 --

class

A

:

pass

class

B

(

A

)

:

pass

print

(

issubclass

(

B

,

A

)

)

Returns True

Python built-in function Python built-in function