+ 3

Can I say Doctstrings as multiple line comment only? Or it is something more?

29th Dec 2016, 9:53 AM
Sumit Singh
Sumit Singh - avatar
2 ответов
+ 5
Docstring is similar to the #comment. Docstrings in particular are placed right after a new function is defined. Ex. def newfunction(): """This is the docstring that explains what newfunction does""" Now if you use help(newfunction) , the docstring is printed. Docstrings are used with help() if you have a mountain of code and need to know what a function does
29th Dec 2016, 4:02 PM
Jess Wolfe
Jess Wolfe - avatar
+ 3
Not only multi-lines comments, you can assign a variable with multi-lines string literals ;) ( and both triple "doube quotes" and triple "single quotes" are valid... )
29th Dec 2016, 10:30 AM
visph
visph - avatar