We should remove all assertions from the codebase and replace them with raise RuntimeError or similar.
Rationale: Assertions are meant for testing purposes and with optimizations enabled (python -O) they are ignored.
This is something uncommon in Python as optimizations do almost nothing and no-one uses them, but for example in C all assertions are removed in release compilation mode. So we should get rid of them to future-proof ourselves, in case Python becomes a JIT-compiled language in the future as it's looking like with Python 3.13 and this becomes an issue.
We should remove all assertions from the codebase and replace them with
raise RuntimeError
or similar.Rationale: Assertions are meant for testing purposes and with optimizations enabled (
python -O
) they are ignored. This is something uncommon in Python as optimizations do almost nothing and no-one uses them, but for example in C all assertions are removed in release compilation mode. So we should get rid of them to future-proof ourselves, in case Python becomes a JIT-compiled language in the future as it's looking like with Python 3.13 and this becomes an issue.