-
Book Overview & Buying
-
Table Of Contents
Supercharged Coding with GenAI
By :
Docstrings are a standard practice for maintaining high-quality code. They enable future readers of the software to understand the code, which is important for debugging, feature enhancements, and more. We recommend docstrings be included as soon as the code has been written. GitHub Copilot offers multiple ways of writing docstrings for a single method, including three single or double quotes, using the Copilot menus on a highlighted method. These approaches will produce single-line docstrings, the Google docstring style, or others when specified as a command.
A challenge in writing software is keeping docstrings up to date with the code. All methods can identify discrepancies between the code and docstrings, which is the preferred method for identifying issues that can be resolved. Alternatively, docstrings can be updated at a method or file level, replacing any existing docstrings.