Co-authored-by: nilbuild <4921183+nilbuild@users.noreply.github.com>
8 lines
783 B
Markdown
8 lines
783 B
Markdown
# Docstrings and Comments
|
|
|
|
Docstrings and comments document what code does and why. A docstring is a string literal placed right after a function, class, or module definition, and it becomes accessible through the object's **doc** attribute, which tools use to generate documentation automatically. Comments, marked with #, explain specific lines or blocks of code and are ignored by the interpreter. Docstrings typically describe the purpose, parameters, and return value of a function, while comments clarify tricky logic or note reasons behind a particular implementation choice.
|
|
|
|
Visit the following resources to learn more:
|
|
|
|
- [@official@Docstring Conventions](https://peps.python.org/pep-0257/)
|
|
- [@article@Python Comments](https://www.w3schools.com/python/python_comments.asp) |