Q. What are doc-strings? How are they useful?
Answer =
A doc-string is just a regular Python triple-quoted string that is the first
thing in a function body/a module/a class. When executing a function body (or a
module/class), the doc-string doesn't do anything like a comments, but Python stores it as part of the function documentation. This
documentation can later be displayed using the help() function.
So, even though doc-strings appear like comments (no execution), they are different from comments.
So, even though doc-strings appear like comments (no execution), they are different from comments.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )