4 ответов
+ 6
@Azeem I am with you
how said that?
+ 2
although we use __init__ almost the same sense as c++/java constructor while programming ( to create members of a new class instance ), it is not really the same in how it works because Python is dynamic language while C++/Java are static. there is no scientific definition of what a constructor is. if you don't have init in your class your code will work and there is no call for a constructor implicitly like C++/Java.
+ 1
__new__ is the constructor, but it is not usually used in classical programming.
__init__, however, is the initialiser, it populates the instance with the given arguments and then you have a working instance
0
They’re constrictors, not constructors. They strangle their prey to death. Must have been a auto correct. 😂 But to be honest, I’m not sure.