What dose __init__ stand for? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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__?

6th Apr 2017, 7:13 PM
anni
3 Answers
+ 8
It gets called when you 'initialize' an instance of a class...
6th Apr 2017, 7:17 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
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.
15th Apr 2017, 6:19 AM
Nilesh
Nilesh - avatar
0
it stands for initialize it's role is creating the object in memory and assigning values to it
3rd May 2017, 1:29 AM
Oussama kasraoui
Oussama kasraoui - avatar