What is the difference between __init__ and __new__ in object creation? #49
Answered
by
lukasmiller3
lukasmiller1
asked this question in
Q&A
-
|
What is the difference between init and new in object creation? |
Beta Was this translation helpful? Give feedback.
Answered by
lukasmiller3
Jan 22, 2026
Replies: 1 comment
-
|
A:new creates the instance (called first, returns the instance), init initializes it (called second, returns None). new is a static method, init is an instance method. Use new for controlling instance creation (singletons, immutable types). |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lukasmiller1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A:new creates the instance (called first, returns the instance), init initializes it (called second, returns None). new is a static method, init is an instance method. Use new for controlling instance creation (singletons, immutable types).