How do __init__ work? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

How do __init__ work?

Could you give me either the answer or a link to it?

6th Aug 2019, 5:09 PM
Gwlanbzh
Gwlanbzh - avatar
6 Respostas
+ 4
Thanks Tibor Santa ! these look good! Ive completed 2 basic python courses snd still have difficulty with OOP
9th Aug 2019, 8:08 AM
Helena
Helena - avatar
+ 3
You can find loads of python oop tutorials online that explain this in detail... https://python.swaroopch.com/oop.html I particularly liked this one because it starts from the very minimum and concludes at the subtle differences between static methods, class methods and instance methods: https://www.python-course.eu/python3_object_oriented_programming.php
9th Aug 2019, 8:01 AM
Tibor Santa
Tibor Santa - avatar
+ 2
The __init__ function in python is the constructor of a class, it is called when you instantiate the object. https://www.sololearn.com/learn/Python/2468/
6th Aug 2019, 5:23 PM
Tibor Santa
Tibor Santa - avatar
0
Tibor Santa Ok but I meant, how does it work *inside*?
9th Aug 2019, 5:50 AM
Gwlanbzh
Gwlanbzh - avatar
0
SpaceNerd maybe it created lots of attributes (2nd argument, 3rd etc) for the first one that you can easier to assign through argument of class and call it out by type ".namemethod"
10th Aug 2019, 6:40 AM
Nguyį»…n TĆ­n
0
SpaceNerd it's a special method for class
10th Aug 2019, 6:42 AM
Nguyį»…n TĆ­n