Sitemap

Python Constructor

--

Python Constructor: A Constructor is a special kind of method automatically called while creating an object. A Constructor is defined in the class, and we can use this method to initialize the basic attributes of the class.

Usually, the constructor has the same name as its class in Java or C++. However, we treat constructor in a different manner in Python.

Get Amansingh Javatpoint’s stories in your inbox

Join Medium for free to get updates from this writer.

Constructors can be classified into two different types:

  1. Parameterized Constructor
  2. Non-Parameterized Constructor

A Constructor is defined and executed when an object of the class is created. Constructors also help to verify that enough resources available for the object to execute any start-up activity.

https://www.tutorialandexample.com/python-constructor/

--

--