-
Book Overview & Buying
-
Table Of Contents
Supercharged Coding with GenAI
By :
This section describes different techniques for creating docstrings for a single method and for a full Python file. Docstrings improve code readability and are often required by organizations as part of their continuous integration/continuous development (CI/CD) pipelines. Using GenAI to create docstrings can increase the speed of the software development process.
The simplest approach to generating a docstring in VS Code is simply typing three double quotes “““ or the equivalent in single quotes on a blank line following the method signature, as shown in Figure 12.4, with results shown in the code block that follows, which can be accepted by pressing tab:

Figure 12.4: Initiating the request for a docstring with three single or double quotes
def get_euclidean_dist(a: np.ndarray, b: np.ndarray) -> float:
'''Calculates the squared Euclidean distance between two...