Docstring
Domain: Software Engineering
π― Motivation
A documentation string inside code. Explains what a function does, its parameters, and return value.
π Concrete Example
Docstring: '''Calculate the average of a list of numbers. Args: numbers (list): List of numbers. Returns: float: The average. Raises: ValueError: If list is empty. ''' Right inside the code, above the function.
π Analogy
A docstring is like a label on a kitchen spice jar - βSalt - for cooking, not baking soda.β It tells you what it is and how to use it, right where you need it. Docstrings label functions in the code.