I'm finding classes very difficult | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm finding classes very difficult

why are underscores needed ? ex: __init__ , __add__

8th Feb 2017, 2:13 AM
Darren Samora
Darren Samora - avatar
2 Answers
+ 1
thanks !!!
9th Feb 2017, 3:15 AM
Darren Samora
Darren Samora - avatar
0
Classes with a double underscore before and after the name are usually predefined classes that you can overwrite. Classes you create yourself however don't need the double underscore, but should usually start with a capital for each word. Eg. class MyClass:
8th Feb 2017, 8:57 AM
Shane Kilpatrick
Shane Kilpatrick - avatar