---
title: "which methods of Python are used to determine the type of instance and inheritance?"  
description: "which methods of Python are used to determine the type of instance and inheritance?"  
author: "Prakash nidhi Verma"  
published: 2018-07-20  
updated: 2020-09-19  
canonical: https://www.mindstick.com/interview/23475/which-methods-of-python-are-used-to-determine-the-type-of-instance-and-inheritance  
category: "python"  
tags: ["variable", "python"]  
reading_time: 1 minute  

---

# which methods of Python are used to determine the type of instance and inheritance?

Built-in functions in Python that work with inheritance: \

1- isinstance() – this method checks the type of instance.

eg. isinstance(myObj, int) – returns True only when myObj. class is int.

2-issubclass() – this method checks class inheritance

eg. ***issubclass(bool, int) – returns True because bool is a subclass of int.

***issubclass(unicode, str) – returns False because unicode is not a subclass of str.

## Answers

### Answer by Prakash nidhi Verma

Built-in functions in Python that work with inheritance: \

1- isinstance() – this method checks the type of instance.

eg. isinstance(myObj, int) – returns True only when myObj. class is int.

2-issubclass() – this method checks class inheritance

eg. ***issubclass(bool, int) – returns True because bool is a subclass of int.

***issubclass(unicode, str) – returns False because unicode is not a subclass of str.


---

Original Source: https://www.mindstick.com/interview/23475/which-methods-of-python-are-used-to-determine-the-type-of-instance-and-inheritance

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
