+ 1
Christian Huml no I see you are learning OOP with Python... My feeling is you are driving too deeply into the dunder methods. It is rarely that there is a need to modify them. Concentrate first on creating attributes and methods, and making custom classes that are useful to you.
4th Sep 2022, 1:26 PM
Bob_Li
Bob_Li - avatar
+ 1
__new__ creates the instance and returns it to __init__. __init__ then initializes the instance. That's why self is required. It points to the instance that __new__ creates.
4th Sep 2022, 3:30 AM
Benjamin Rogers
Benjamin Rogers - avatar
+ 1
Christian Huml here is a YouTube channel I regularly visit. The contents are great and there are also some good videos about dunder methods. https://m.youtube.com/c/mCodingWithJamesMurphy
6th Sep 2022, 5:36 PM
Bob_Li
Bob_Li - avatar