Search notes:

Python: issubclass

#!/usr/bin/python3

class A():
    pass

class B(A):
    pass

class C(B):
    pass

if issubclass(A, B):
   print('A is a subclass of B')
else:
   print('A is not a subclass of B')

if issubclass(B, A):
   print('B is a subclass of A')
else:
   print('B is not a subclass of A')

if issubclass(C, A):
   print('C is a subclass of A')
else:
   print('C is not a subclass of A')
#
# A is not a subclass of B
# B is a subclass of A
# C is a subclass of A
Github repository about-python, path: /builtin-functions/issubclass/derivation.py

See also

isinstance
Python: Built in functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199200, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/built-in-functions/issubclass/index(69): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78