What is the purpose of `__init__` in a Python class?

Python Developer Easy

Python Developer — Easy

What is the purpose of `__init__` in a Python class?

Key points

  • `__init__` is not for destroying instances
  • It is not a class-level constructor
  • `__init__` does not initialize class variables shared across all instances

Ready to go further?

Related questions