Files

8 lines
783 B
Markdown
Raw Permalink Normal View History

2026-07-21 18:00:07 +02:00
# Docstrings and Comments
2026-07-28 11:53:28 +02:00
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.
2026-07-21 18:00:07 +02:00
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)