+1

You proposed using assertions in python, which is considered code smell outside of testing.

Annoying Adam il y a 3 mois mis à jour il y a 3 mois 0

In this post: Introduce Assertion (refactoring.guru)
The python version of the code uses "assert" keyword which is always discouraged from being used outside tests because all assertions can be easily bypassed with debugging flag.
So in production code this is a code smell in python, and instead a "raise" keyword should be used.