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.