Skip to content

Entries published on December 11, 2023

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

Raise the right exceptions

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.

Let’s have an argument

Suppose you write a function like this:

def divide(dividend, divisor):
    """
    Divide ``dividend`` by ``divisor`` and return the result.

    """
    return dividend / divisor

There are a couple things that could go wrong here:

Entry published December 11, 2023. Read full entry.