Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Photo by vivek kumar on Unsplash

Member-only story

Parents And Children In Python

4 min readFeb 19, 2021

--

As you might know, creating a fully functional class in an object-oriented programming language is time-consuming because real classes perform a lot of complex tasks.

In Python, you can get the features you want from an existing class(parent) to create a new class(child). This Python feature is called inheritance.

By inheritance, you can

  • obtain the features of a parent class,
  • change the features that you don’t need,
  • add new features to your child class. (derived class or subclass)

Since you are using a pre-used, tested class, you don’t have to put quite as much effort into your new class. The child class inherits the attributes and functions of its parent class.

If we have several similar classes, we can define the common functionalities of them in one class and define child classes of this parent class and implement specific functionalities there.

Three Data Professionals

Image by Author

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

No responses yet