+1

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

Annoying Adam 9 місяців тому оновлений 9 місяців тому 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.