What is the difference between dunder new and dunder init?
Object-oriented programming
Audio flashcard · 0:15Nortren·
What is the difference between dunder new and dunder init?
0:15
Dunder new is a static method that creates and returns a new instance. Dunder init initializes the already-created instance. New is rarely overridden except for immutable types or singletons. Init is overridden in almost every custom class to set up instance state.
docs.python.org