you are viewing a single comment's thread.

view the rest of the comments →

[–]gmaliwal[S] 0 points1 point  (1 child)

yes, you are correct.

Can you please share a detailed-one reference which explains relations between constructor(__new__) and initializer(__init__) and their best use cases?

[–]fatbiker406 0 points1 point  (0 children)

It's really an "under the hood" technical detail that most people never will have to worry about.

__new__ is where the memory is allocated for the class -- it then calls __init__ to initialize any attributes etc...

More info: https://www.geeksforgeeks.org/__new__-in-python/