+ 1
What do the double __ at the front and back of a variable(?) represent?
Hi, I'm a new learner and have touched on the basics of python and I am planning to learn both python and C# as I have an end goal I want to reach. I've seen some people who code and write stuff like __main__, __init__ and I'm rather puzzled to what they represent. Any insight in this would be appreciated, thanks! EDIT: I don't know how to post a reply to an answer, but thank you user RedAnt for the response and resources that I can check out!
1 Antwort
+ 1
these are magic methods and they have special functions ( __init__ is called after an object is created). they also can be used to overload operators and define conversions. some of them are explained in section with object oriented programming. you can get some more info about them here http://www.rafekettler.com/magicmethods.html