Answer the question
In order to leave comments, you need to log in
Who can explain in simple terms what "__" means for python?
I constantly meet in classes __init__(). I plunged into the documentation, but due to my lack of knowledge of English, I did not really understand this magic. Please explain in simple terms.
Answer the question
In order to leave comments, you need to log in
Just the name of the method. The presence of "__" does not give any special properties (I cannot but mention name mangling , although in this case it has nothing to do with it).
Objects in python have a number of special methods (more precisely, property names) that will be called in certain cases of using the object (if, of course, such properties are defined).
__init__
called after object creation, usually used to initialize it. And, for example, __str__
when converting an object to a string (for example, str(obj)).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question