December 2000
Intermediate to advanced
816 pages
16h 57m
English
The issubclass() Boolean function determines if one class is a subclass or descendant of another class. It has the following syntax:
issubclass(sub, sup)issubclass() returns 1 if the given subclass sub is indeed a subclass of the superclass sup. This function allows for an “improper” subclass, meaning that a class is viewed as a subclass of itself, so the function returns 1 if sub is either the same class as sup or derived from sup. (A “proper” subclass is strictly a derived subclass of a class.)
If we were to implement the issubclass() built-in function ourselves, it may look something like the following:
def my_issubclass(sub, sup): if sub is sup ...
Read now
Unlock full access