Docstrings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Docstrings

It's a little bit confused me ---- Is docstring=multiline comment in Python3? And is docstring different than multiline comment only with it's calling function __doc__?

7th Aug 2018, 8:44 AM
tardigrade
tardigrade - avatar
4 Answers
+ 7
Docstrings are multiline comments included inside functions and modules, usually at the beginning of them, to provide information about their purposes/functionalities. When executing the "help" command on a function, its docstring is shown for the developer to know what it does. Try using the interactive shell to call the "help" command on some functions to inspect their docstrings. 😁
7th Aug 2018, 1:13 PM
Eduardo Petry
Eduardo Petry - avatar
+ 6
I wrote a code snippet to better capture what I was talking about: https://code.sololearn.com/cjmZy1hUsEow/?ref=app
7th Aug 2018, 1:30 PM
Eduardo Petry
Eduardo Petry - avatar
+ 3
I understand for myself this section of Python like this. Am I right? comment(multiline comment (docstring))
7th Aug 2018, 1:20 PM
tardigrade
tardigrade - avatar
+ 1
Another name for docstring is multiline strings or comment
26th Dec 2018, 8:02 PM
Fredrick Trust
Fredrick Trust - avatar