midPython
__init__ vs __new__
Updated May 4, 2026
Short answer
__new__ creates the object; __init__ initializes it.
Deep explanation
__new__ is the actual constructor (static method). __init__ sets the attributes on the created instance.
Real-world example
Implementing a Singleton pattern where only one instance of a class can ever exist.
Common mistakes
- Returning a value from __init__ (it must return None).
Follow-up questions
- Which is called first?