+ 3
What is the importance of the underscores used before and after "doc" when printing a multi line comment?
__doc__
3 odpowiedzi
+ 2
Please tag your question with python.
The __doc__ is a builtin attribute of every object (class or function) on python. It is auto generated from the triple double quote docstring that comes immediately after the object header.
https://code.sololearn.com/c4hPmv1aeS5e/?ref=app
+ 2
I never knew it was an in-built attribute but what I know is that underscores are sometimes placed
in front of such statement to tell it to access the value within the class not an external resource.
0
Typically if a variable in python begins with underscore, it is considered 'private' (do not modify this from the outside)
Also double underscore (also called 'dunder' has special meanings.
Read this for more details
https://dbader.org/blog/meaning-of-underscores-in-python