Python Developer — Hard
Key points
- __new__ creates and returns the instance
- __init__ initializes the instance
- __new__ is called before __init__
- __new__ is used for singletons and immutable types
- __new__ must return an instance for __init__ to run
Ready to go further?
Related questions
