About 411,000 results
Open links in new tab
  1. __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, …

  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 …

  3. dataclasses — Data Classes — Python 3.14.2 documentation

    1 day ago · Module contents ¶ @dataclasses.dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, …

  4. Understand __init__ Method in Python

    Oct 7, 2025 · Learn how to use Python's __init__ method for object initialization. This guide covers basic usage, inheritance, validation techniques, and best practices.

  5. 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 …

  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 · This comprehensive guide explores Python's __init__ method, the special method responsible for object initialization. We'll cover basic usage, inheritance, default values, …

  8. Python __init__ () - Working and Examples

    __init__() is a built-in function in Python that is called whenever an object is created. It initializes the state for the object, meaning it's where we can set the attributes of an object.

  9. “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 …

  10. Python __init__ () Function: Syntax, Usage, and Examples

    Learn how the Python __init__ () function works to initialize objects, handle parameters, and support inheritance with practical examples and best practices.