About 98,900 results
Open links in new tab
  1. __init__ in Python - GeeksforGeeks

    May 11, 2026 · __init__ () method is a constructor which is automatically called 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.

  2. 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 perform operations …

  3. 9. ClassesPython 3.14.5 documentation

    2 days ago · When a class defines an __init__() method, class instantiation automatically invokes __init__() for the newly created class instance. So in this example, a new, initialized instance can be …

  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 object from a …

  5. Python Class Constructors: Control Your Object Instantiation

    In this tutorial, you'll learn how class constructors work in Python. You'll also explore Python's instantiation process, which has two main steps: instance creation and instance initialization.

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

    Jul 8, 2017 · The first argument of every class method, including init, is always a reference to the current instance of the class. By convention, this argument is always named self.

  7. Python Class `__init__` Method: A Comprehensive Guide

    Jan 29, 2025 · Understanding how the `__init__` method works is essential for writing clean, organized, and efficient Python code. This blog post will dive deep into the fundamental concepts, usage …

  8. Python __init__ - Python Tutorial

    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 underscores (__) on …

  9. Python Classes and Objects: A Beginner's Guide to OOP

    May 15, 2026 · The Python course on OpenPython covers object-oriented programming in a dedicated module, building from basic classes through to inheritance with hands-on coding exercises.

  10. You are probably using Python’s __init__ method incorrectly

    Aug 16, 2023 · How a new object should be created is usually defined in the special __init__ method implemented on a class. A simple class that stores two instance variables could be implemented as …