What is the difference between docstrings and comments? The example in a lesson doesn't explains it very well. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between docstrings and comments? The example in a lesson doesn't explains it very well.

docstrings vs. comments

23rd Mar 2018, 5:05 AM
Igor Matić
Igor Matić - avatar
2 Answers
+ 2
docstings are for people, who want to use your code without wanting to know how its works. docstrings can be turned into actual documentation. And Comments, as name suggests it shows you whatever is going on with your code(in a statement , loop, etc).
23rd Mar 2018, 5:41 AM
Nilesh
Nilesh - avatar
0
that's the part w/ docstrings i dont get. how a docstring can be turned into a documentation? why? can you give me an example?
23rd Mar 2018, 5:49 AM
Igor Matić
Igor Matić - avatar