Construction is implicit in python, __init__ is used for initialization of a new object. There is a __new__ constructor, but you'll likely not need to write one ever. https://docs.python.org/3/reference/datamodel.html#classes 3.2.8.8. Classes Classes are callable. These objects normally act as factories for new instances of themselves, but variations are possible for class types that override __new__() . The arguments of the call are passed to __new__() and, in the typical case, to __init__() to initialize the new instance. Answer from xelf on reddit.com
🌐
Real Python
realpython.com › python-class-constructor
Python Class Constructors: Control Your Object Instantiation – Real Python
January 19, 2025 - The tool responsible for running this instantiation process is commonly known as a class constructor. ... In Python, to construct an object of a given class, you just need to call the class with appropriate arguments, as you would call any function: ... >>> class SomeClass: ... pass ... >>> # Call the class to construct an object >>> SomeClass() <__main__.SomeClass object at 0x7fecf442a140> In this example, you define SomeClass using the class keyword.
🌐
GeeksforGeeks
geeksforgeeks.org › python › constructors-in-python
Constructors in Python - GeeksforGeeks
July 11, 2025 - class ClassName: def __new__(cls, parameters): instance = super(ClassName, cls).__new__(cls) return instance ... This method initializes the newly created instance and is commonly used as a constructor in Python.
Discussions

what are constructors in python?
Construction is implicit in python, __init__ is used for initialization of a new object. There is a __new__ constructor, but you'll likely not need to write one ever. https://docs.python.org/3/reference/datamodel.html#classes 3.2.8.8. Classes Classes are callable. These objects normally act as factories for new instances of themselves, but variations are possible for class types that override __new__() . The arguments of the call are passed to __new__() and, in the typical case, to __init__() to initialize the new instance. More on reddit.com
🌐 r/learnpython
23
11
June 30, 2025
Is a constructor __init__ necessary for a class in Python? - Stack Overflow
What is the difference between ... in Python? 2016-07-10T09:02:01.547Z+00:00 ... Though __new__ is pretty much advanced feature and you won't come across it that often in code. I just wanted to show the difference between __init__ and __new__. __init__ is not the constructor, it's the method used to initialize the object's members (e.g., name, address, phone...) during the creation time of that object (when you call the class). So you shouldn't think of the example I provided ... More on stackoverflow.com
🌐 stackoverflow.com
Add automatic constructor for classes - Ideas - Discussions on Python.org
In practice most constructor implementations are trivial in that they simply map self attributes to correspondingly named parameters. class Foo: x: int y: int z: int def __init__(self, x: int, y: int, z: int): self.x = x self.y = y self.z = z The typical workflow consists of a) annotating the ... More on discuss.python.org
🌐 discuss.python.org
0
July 17, 2024
What exactly is a constructor, and what does it do?
'Aight. Here we go. A class is a blueprint, like a house that hasn't been built yet. An object is the house, fully built. A constructor takes the class (blueprint) and spits out an object (house). Every time you call the constructor, it spits out another house. Now let's pretend that you're an architect and you want to build a neighborhood. You write up a blueprint (class) and then hire a construction team (constructor). You give them the blueprint and say, "Make 30 houses like this." Each time they build a house (object), they look at your blueprint (class). At the end you have 30 houses based on the same blueprint. This process is called Object Oriented Programming (OOP). The big advantage it offers is ease of reproducability. Once you've made the blueprint, you can make 30 or 300 or 3000 houses. And fixing the houses is really easy, because they're all basically the same. More on reddit.com
🌐 r/learnprogramming
21
52
March 10, 2018
🌐
Python Basics
pythonbasics.org › home › python basics › what is a constructor in python?
What is a constructor in Python? - pythonbasics.org
The example belwo shows two classes with constructors. Then two objects are created but different constructors are called. ... class Bug: def __init__(self): self.wings = 4 class Human: def __init__(self): self.legs = 2 self.arms = 2 bob = Human() tom = Bug() print(tom.wings) print(bob.arms) ...
🌐
Rollbar
rollbar.com › home › the python constructor pattern most tutorials won’t teach you
Python Constructors in Practice: Real Examples That Click
October 20, 2025 - Single __init__ method: Unlike some languages, Python doesn't support method overloading (but our factory pattern solves this!) Performance overhead: Complex initialization logic can slow object creation · Testing complexity: Objects with complex constructors can be harder to test · Dependency issues: Constructors that do too much can create tight coupling · Let's combine everything with a real-world example that uses the factory method pattern: class APIClient: """A flexible API client using multiple constructor patterns.""" def __init__(self, base_url, auth_token, timeout=30): self.base_u
🌐
Flexiple
flexiple.com › python › python-constructors
Python constructors - How to use them? | Flexiple Tutorials | Python - Flexiple
April 26, 2022 - There are two different types of constructors in Python: The parameterized constructor has multiple parameters along with the self. It takes its first argument as a reference to the instance being constructed, known as self, and the rest of the arguments are provided by the programmer. class Student: # Parameterized constructor def __init__(self, name, roll_no): self.name = name self.roll_no = roll_no def display(self): print("Roll No.: %d \nName: %s" % (self.roll_no, self.name)) # Creating object of the class stud1 = Student("Navya", 34) stud2 = Student("Mia", 67) stud1.display() stud2.display()
🌐
Python
typing.python.org › en › latest › spec › constructors.html
Constructors — typing documentation
If the evaluated return type of ... attempt to evaluate the __new__ or __init__ methods on the class. For example, some metaclass __call__ methods are annotated to return NoReturn to indicate that constructor calls are not supported for that class....
🌐
Tutorialspoint
tutorialspoint.com › python › python_constructors.htm
Python - Constructors
Python uses a special method called __init__() to initialize the instance variables for the object, as soon as it is declared. The __init__() method acts as a constructor. It needs a mandatory argument named self, which is the reference to the object. def __init__(self, parameters): #initialize instance variables · The __init__() method as well as any instance method in a class has a mandatory parameter, self.
Find elsewhere
🌐
Wiingy
wiingy.com › home › learn › python › constructors in python
Constructors in Python (With Examples) - Wiingy
April 15, 2025 - In the above example, we have defined a parameterized constructor for the Employee class, which takes three arguments, name, age, and salary, and initializes the instance variables of the class with the values passed as arguments. The self parameter is used to access the instance variables and set their values. Explanation of how self parameter works in constructors: When we create an object of a class, Python automatically passes the reference to that object as the first parameter to the constructor.
Top answer
1 of 6
7

I see a misconception here between a constructor--constructing the object and initializing the object:

Python's use of __new__ and __init__?

Use __new__ when you need to control the creation of a new instance. Use __init__ when you need to control initialization of a new instance.

So we must be careful here.

I read that the constructor is like the first argument passed to the class, which makes sense to me since the parameters seem to be passed to the class via the __init__ method.

The constructor is not passed to the class, to be precise the result of the constructor (__new__) will be the first argument for every instance method in the class or its sub-classes (note: __new__ works only for new-style classes):

class A:
    def __new__(self):
            return 'xyz'

See what happens when you call the class (create the object):

>>> A()
'xyz'
>>> type(A())
<class 'str'>

Calling the class no longer return instance of type A, because we changed the mechanism of the constructor __new__. Actually by doing so you alter the whole meaning of your class, not only, this is pretty much hard to decipher. It's unlikely that you'll switch the type of object during the creating time of that specific object. I hope this sentence makes sense, if not, how will it make sense in your code!

class A:
    def __new__(self):
            return 'xyz'

    def type_check(self):
            print(type(self))

Look what happens when we try to call type_check method:

>>> a = A()
>>> a
'xyz'
>>> a.type_check()
AttributeError: 'str' object has no attribute 'type_check'

a is not an object of class A, so basically you don't have access to class A anymore.

__init__ is used to initialize the object's state. Instead of calling methods that will initialize the object's members after it's created, __init__ solves this issue by initializing the object's members during creation time, so if you have a member called name inside a class and you want to initialize name when you create the class instead of calling an extra method init_name('name'), you would certainly use __init__ for this purpose.

So when I 'call' the class, I pass it the parameters from the __init__ method?

When you call the class, you pass the parameters (to) __init__ method?

Whatever arguments you pass the class, all the parameters will be passed to __init__ with one additional parameter added automatically for you which is the implied object usually called self (the instance itself) that will be passed always as the left-most argument by Python automatically:

class A:
    def __init__(self, a, b):
        self.a = a
        self.b = b 

        A(  34,  35) 
 self.a = 34 |    |  
             |    | 
             |    | self.b = 35  
  init(self, a,   b)
        |
        |
        | 
       The instance that you created by calling the class A() 

Note: __init__ works for both classic classes and new style classes. Whereas, __new__ works only for new-style classes.

2 of 6
4

No, the constructor is just the method that is called to construct the object. It is not passed anywhere. Rather the object itself is passed automatically to all methods of the class.

Constructor is not required if you don't have anything to construct but usually you have something to do in the beginning.

🌐
PYnative
pynative.com › home › python › python object-oriented programming (oop) › constructors in python
Constructor in Python [Guide] – PYnative
August 28, 2021 - Python allows us to define a constructor with default values. The default value will be used if we do not pass arguments to the constructor at the time of object creation. The following example shows how to use the default values with the constructor. ... class Student: # constructor with default values age and classroom def __init__(self, name, age=12, classroom=7): self.name = name self.age = age self.classroom = classroom # display Student def show(self): print(self.name, self.age, self.classroom) # creating object of the Student class emma = Student('Emma') emma.show() kelly = Student('Kelly', 13) kelly.show() Code language: Python (python) Run
🌐
Python.org
discuss.python.org › ideas
Add automatic constructor for classes - Ideas - Discussions on Python.org
July 17, 2024 - In practice most constructor implementations are trivial in that they simply map self attributes to correspondingly named parameters. class Foo: x: int y: int z: int def __init__(self, x: int, y: int, z: int): self.x = x self.y = y self.z = z The ...
🌐
Python documentation
docs.python.org › 3 › tutorial › classes.html
9. Classes — Python 3.14.3 documentation
In our example, the call x.f() is exactly equivalent to MyClass.f(x). In general, calling a method with a list of n arguments is equivalent to calling the corresponding function with an argument list that is created by inserting the method’s instance object before the first argument. In general, methods work as follows. When a non-data attribute of an instance is referenced, the instance’s class is searched.
🌐
WsCube Tech
wscubetech.com › resources › python › constructors
Constructors in Python: Syntax, Types, Examples
October 1, 2025 - Learn about Python constructors , its examples, rules, types, and advantages. Understand how constructors work in object-oriented programming in this tutorial.
🌐
ScholarHat
scholarhat.com › home
Understanding Constructors in Python
September 10, 2025 - There are three main types of constructors in Python: Default Constructor, Parameterized Constructor, and Non-Parameterized Constructor. Let’s explore them one by one with examples. A default constructor is perfect when you want to create an object with predefined values. You don’t need to provide any arguments, it handles everything for you. Want to see how it works? class Person: def __init__(self): self.name = "John" self.age = 30 # Creating an object person = Person() print(person.name) print(person.age)
🌐
Codedamn
codedamn.com › news › python
Explaining Constructor in Python With an Example
August 28, 2023 - In Python, it is possible to define multiple constructors in a single class using the @classmethod decorator. A class method is a method bound to the class and not the instance of the class. Here is an example of how you can define multiple constructors in a single class using class methods in Python:
🌐
Medium
kristiyanradev.medium.com › constructors-in-python-24d8ae97d520
Constructors in Python. Python’s class constructor is a… | by Kristiyan Radev | Medium
February 5, 2024 - In order to construct an object ... will become the so called object of your class) In the above example we define a class called Policeman....
🌐
Real Python
realpython.com › python-multiple-constructors
Providing Multiple Constructors in Your Python Classes – Real Python
February 1, 2025 - The third example shows how CumulativePowerFactory seems to have another constructor that allows you to create instances by providing the exponent and start arguments. Now .total starts with a value of 2205, which initializes the sum of powers. Using optional arguments when you’re implementing .__init__() in your classes is a clean and Pythonic technique to create classes that simulate multiple constructors.
🌐
Upgrad
upgrad.com › home › tutorials › software & tech › constructor in python
Constructor in Python: Comprehensive Guide and Examples | upGrad
January 5, 2026 - In this example, the MyClass class defines a default constructor using the __init__ method. Inside the constructor, it initializes the value attribute to 0 by default. When you create an object of the MyClass class using obj = MyClass(), the ...
🌐
BeginnersBook
beginnersbook.com › 2018 › 03 › python-constructors-default-and-parameterized
Python Constructors – default and parameterized
March 10, 2018 - As you can see that with such type ... read_number(self): print(self.num) # creating object of the class # this will invoke parameterized constructor obj = DemoClass(55) # calling the instance method using the object obj obj.read_number() # creating another object of the class obj2 ...