Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Useful Functions | Inheritance
In-Depth Python OOP
course content

Зміст курсу

In-Depth Python OOP

Useful Functions

isinstance()

The isinstance() (is instance) is a Python built-in function that checks object is an instance of a certain class and return the bool value (True or False). This function takes 2 arguments: instance and class:

You can use this function to check your instances:

issubclass()

The issubclass() (is subclass) is a Python built-in function that checks class is a Child of another class:

The issubclass() function works with classes only. If you want to check the instance, use the type() function inside the issubclass():

Все було зрозуміло?

Секція 2. Розділ 6
We're sorry to hear that something went wrong. What happened?
some-alt