+ 1
What dose __init__ stand for?
I dont mean what you need it for ect., just what it stands for/why is it explicitly __init__?
3 Respostas
+ 8
It gets called when you 'initialize' an instance of a class...
0
It's a predefined function or method in python and referred as one of the magic methods in python.
It acts in the same way as constructors in C++/C# etc.
You can say it's used to initialize attributes of a class when the object is created for the first time. It can be parameterized or without any parameters. It's called automatically when class instance is created. One class can have one and only one __init__ method definition.
0
it stands for initialize
it's role is creating the object in memory and assigning values to it