Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace assertions with errors #347

Open
toni-neurosc opened this issue Jun 21, 2024 · 1 comment
Open

Replace assertions with errors #347

toni-neurosc opened this issue Jun 21, 2024 · 1 comment
Assignees

Comments

@toni-neurosc
Copy link
Collaborator

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.

@timonmerk
Copy link
Contributor

Agree! Tbh I wasn't sure when implementing them if it should be used for that purpose. But now I understand it's only for testing.

@toni-neurosc toni-neurosc self-assigned this Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants