mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-09-19 09:32:03 +08:00
Co-authored-by: nilbuild <4921183+nilbuild@users.noreply.github.com>
783 B
783 B
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: