Aug. 13, 2023, 8:43 a.m. | Sachin

DEV Community dev.to

You must have seen the implementation of the __init__ method in any Python class, and if you have worked with Python classes, you must have implemented the __init__ method many times. However, you are unlikely to have implemented or seen a __new__ method within any class.


In this article, we'll see:



  • Definition of the __init__ and __new__ methods


  • __init__ method and __new__ method implementation


  • When they should be used


  • The distinction between the two methods






__init__ Vs __new__ Method


The …

article implementation oop programming python python classes tutorial

Lead Developer (AI)

@ Cere Network | San Francisco, US

Research Engineer

@ Allora Labs | Remote

Ecosystem Manager

@ Allora Labs | Remote

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote