Category Python

Types of Inheritance in Python

Different types of inheritance in Python

Inheritance in Python is a mechanism that allows a new class to inherit all the attributes and methods of an existing class. It is one of the most important feature of OOPs concept in Python because it promotes reusability, readability,…

Inheritance in Python (with Example)

How features of superclass is inherited in subclass via inheritance in Python

Inheritance is a powerful object-oriented programming feature offered by Python. This powerful feature allows to one class to inherit the properties and behaviors of another class. For example, some classes can have common members like fields / variables or methods…

Static Method in Python

A method defined with an @staticmethod decorator in a class is called static method in Python. Similar to the class method, this method also belongs to a class rather than an instance of the class. Since a static method does…

Class Method in Python

When we define a method using @classmethod decorator inside a class, it is called class method in Python. This method is independent of any specific instance of the class. A class method is related to class rather than instances created…

Instance Method in Python

When we define a function inside a class definition, it is called instance method in Python. It belongs to a specific instance of a class, which is passed as the first argument in the method definition. By convention, this argument…