About 509,000 results
Open links in new tab
  1. Python __init__ () Method - W3Schools

    All classes have a built-in method called __init__(), which is always executed when the class is being initiated. The __init__() method is used to assign values to object properties, or to …

  2. __init__ in Python - GeeksforGeeks

    Sep 12, 2025 · It runs automatically when a new object of a class is created. Its main purpose is to initialize the object’s attributes and set up its initial state. When an object is created, …

  3. Python Class Constructors: Control Your Object Instantiation

    Jan 19, 2025 · Creating a class constructor in Python involves understanding the instantiation process, which consists of two steps: instance creation and instance initialization. You start …

  4. Understand __init__ Method in Python

    Oct 7, 2025 · The __init__ method (pronounced “dunder init” – short for double underscore init) is a special method in Python classes that gets called automatically when you create a new …

  5. Initializing Classes in Python: A Comprehensive Guide

    Mar 23, 2025 · In Python, the __init__ method is the special method that is called when an object of a class is instantiated. It serves as the constructor for the class. The first parameter of the …

  6. Python __init__

    When you create a new object of a class, Python automatically calls the __init__() method to initialize the object’s attributes. Unlike regular methods, the __init__() method has two …

  7. Python __init__ Method - Complete Guide - ZetCode

    Apr 8, 2025 · We'll cover basic usage, inheritance, default values, multiple constructors, and practical examples. The __init__ method is a special method in Python classes that initializes …

  8. “What is __init__ in Python? Explained with Examples”

    Sep 2, 2024 · When you create an object (or instance) from a class, Python automatically calls the __init__ method to ensure that the object is initialized with the appropriate attributes. In …

  9. oop - What do __init__ and self do in Python? - Stack Overflow

    Jul 8, 2017 · When you call A() Python creates an object for you, and passes it as the first parameter to the __init__ method. Any additional parameters (e.g., A(24, 'Hello')) will also get …

  10. Python classes __init__ () method - Pynerds

    In OOP, constructors are special methods that are used to initialize objects of a given class. They provide a way to perform initialization tasks such as setting default values and assigning the …