Skip to content

Entries published on December 10, 2023

1 entry published on this date. See also: all entries published in December 2023, full archive.

Test your documentation

This is part of a series of posts I’m doing as a sort of Python/Django Advent calendar, offering a small tip or piece of information each day from the first Sunday of Advent through Christmas Eve. See the first post for an introduction.

Consider a docstring

Suppose you’re writing a Python function and, as you’re supposed to do, you give it a docstring, and you even provide some examples of how the function is supposed to work. Like this:

def is_even(number: int) -> bool:
    """
    Determine whether the given number is even.

    Examples:

    >>> is_even(4)
    False …

Entry published December 10, 2023. Read full entry.