A key point that others have referred to but I want to emphasize a bit more, as it seems to be at the root of a lot of your confusion here and is crucial for understanding what’s going on here, is understanding the difference between a class and an instance of a class. Let’s suppose we have the foll… Answer from CAM-Gerlach on discuss.python.org
🌐
W3Schools
w3schools.com › Python › python_class_init.asp
Python __init__() Method
Python Examples Python Compiler ... ... All classes have a built-in method called __init__(), which is always executed when the class is being initiated....
Discussions

What does __init__ and self do in python?
What does __init__ and self do in Python? __init__ is used to initialise the created class instance, in practice this mostly means setting the attributes the methods expect it to have. self refers to the current instance, although the name itself isn't special in any way whatsoever - you could use whatever valid identifier you wanted, although I don't particularly recommend deviating from established practices here because we're used to self. As for why your code doesn't do what you think, you never called that method. Random_Player = Game('Male', 19) Random_Player.score() As a side note I recommend reading PEP-8, PEP-257, and PEP-484 as the official style guide. More on reddit.com
🌐 r/learnpython
40
118
January 19, 2024
Understanding classes, init and self
Could you explain this code excerpt? I am learning and trying to get in touch with the logic of classes. class NewWindow(tk.Toplevel): def __init__(self): super().__init__() self.title("Another window") More on discuss.python.org
🌐 discuss.python.org
19
0
February 16, 2024
🌐
GeeksforGeeks
geeksforgeeks.org › python › __init__-in-python
__init__ in Python - GeeksforGeeks
DSA Python · Data Science · NumPy · Pandas · Practice · Django · Flask · Last Updated : 11 May, 2026 · __init__() method is a constructor which is automatically called when a new object of a class is created.
Published: May 11, 2026
🌐
Reddit
reddit.com › r/learnpython › what does __init__ and self do in python?
What does __init__ and self do in python? : r/learnpython
January 19, 2024 - The Book class example is just to show how Python classes work. The __init__ method is used for initializing an object's initial state, and self refers to the specific instance of the object, allowing each instance to have its own data.
🌐
Python.org
discuss.python.org › python help
Understanding classes, init and self - Python Help - Discussions on Python.org
February 16, 2024 - Could you explain this code excerpt? I am learning and trying to get in touch with the logic of classes. class NewWindow(tk.Toplevel): def __init__(self): super().__init__() self.title("Another window")
🌐
StrataScratch
stratascratch.com › blog › what-is-the-purpose-of-__init__-in-python
What Is the Purpose of __init__ in Python? - StrataScratch
November 7, 2024 - In Python, the __init__ method is a class initializer. Before a new object is returned, it executes the __init__ method to initialize its state.
Find elsewhere
🌐
Mimo
mimo.org › glossary › python › init-function
Python __init__() Function: Syntax, Usage, and Examples
The Python __init__() function serves as the constructor method for classes. It initializes newly created objects and allows you to assign values to object properties or run startup procedures when an instance is created.
🌐
Udacity
udacity.com › blog › __init__-in-python-an-overview
__init__ in Python: An Overview | Udacity
June 10, 2026 - The __init__ method lets the class initialize the object’s attributes. It assigns them their first values. It does not create the object itself. ... When you write UserAccount("sam", "sam@example.com"), Python creates the object, then calls __init__ to store "sam" and "sam@example.com" as attributes on that specific instance.
🌐
Medium
medium.com › @cautaerts › you-are-abusing-the-init-method-db5ec7fb3df
You are probably using Python’s __init__ method incorrectly | by Niels Cautaerts | Medium
November 2, 2023 - Python is an object oriented language. How a new object should be created is usually defined in the special __init__ method implemented on a class.
🌐
Python documentation
docs.python.org › 3 › tutorial › classes.html
9. Classes — Python 3.14.8 documentation
1 week ago - When a class defines an __init__() method, class instantiation automatically invokes __init__() for the newly created class instance.
🌐
Medium
medium.com › @jayantnehra18 › class-initialization-in-python-490ff3cef10f
Class Initialization in Python. When we create an object from a class… | by Jayant Nehra | Medium
July 2, 2025 - It’s not just a convention — __init__ is Python’s built-in way of letting us customize how objects are initialized right after they’re created. I’ll use a simple User class throughout to keep examples clear and practical.
🌐
Real Python
realpython.com › python-class-constructor
Python Class Constructors: Control Your Object Instantiation – Real Python
October 21, 2025 - Python handles instantiation internally with .__new__() for creation and .__init__() for initialization. You can customize object initialization by overriding the .__init__() method in your class.
🌐
Pynerds
pynerds.com › python-classes-init-method
Python classes __init__() method
Welcome to GeorginaRamos's Video Chat! Here You can watch the Performer's free, live camera feed · scroll down · © 2026 livejasmin.com - All Rights Reserved! | Enter ONLY if you are at least 18 years old and agree to our cookie rules
🌐
Langchain
reference.langchain.com › python › langchain
langchain | LangChain Reference
This is the configuration format used in the HumanInTheLoopMiddleware.__init__ method.
🌐
W3Schools
w3schools.com › python › gloss_python_class_init.asp
Python __init__() Function
Note: The __init__() method is called automatically every time the class is being used to create a new object. Python Syntax Tutorial Class Create Class Object Methods self Modify Object Properties Delete Object Properties Delete Object Class pass Statement
🌐
iBiblio
ibiblio.org › g2swap › byteofpython › read › class-init.html
The __init__ method
The __init__ method is run as soon as an object of a class is instantiated. The method is useful to do any initialization you want to do with your object. Notice the double underscore both in the beginning and at the end in the name. ... #!/usr/bin/python # Filename: class_init.py class Person: ...
🌐
Real Python
realpython.com › python-init-py
What Is Python's __init__.py For? – Real Python
July 9, 2025 - Python’s special init.py file marks a directory as a regular Python package and allows you to import its modules. This file runs automatically the first time you import its containing package. You can use it to initialize package-level variables, define functions or classes, and structure the package’s namespace clearly for users.
🌐
Scaler
scaler.com › home › topics › __init__ in python
__init__ in Python - Scaler Topics
December 1, 2023 - In an object-oriented approach, the __init__ method is the Python equivalent of the C++ constructor. Every time an object is created from a class, the __init__function is called. The __init__ method only allows the class to initialize the object's attributes.
🌐
Instagram
instagram.com › popular › python-class-init
Python Class Init
April 17, 2026 - Welcome back to Instagram. Sign in to see what your friends, family and interests have been capturing and sharing around the world.
🌐
Great Learning
mygreatlearning.com › blog › it/software development › python __init__: an overview
Python __init__: An Overview
October 14, 2024 - So, to sum it all up, __init__ is a reserved method for classes in Python that basically behaves as the constructors. In other words, this method in a Python class is used for initialising the attributes of an object.