MemotivaObject-oriented programming

What is the dunder init method?

Object-oriented programming

Audio flashcard · 0:15

Nortren·

What is the dunder init method?

0:15

Dunder init is the initializer method called automatically when a new instance is created. It receives the new instance as self and can set initial attribute values. It is not technically a constructor; the actual construction is done by dunder new, which creates the instance before init runs.
docs.python.org