Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Use explicit exception raising instead of asserts #46

Closed
leits opened this issue Aug 13, 2021 · 3 comments
Closed

Use explicit exception raising instead of asserts #46

leits opened this issue Aug 13, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@leits
Copy link
Contributor

leits commented Aug 13, 2021

The current code generator emits no code for an assert statement when optimization is requested at compile time.

https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement
and https://stackoverflow.com/questions/944592/best-practice-for-using-assert

Please, don't use asserts outside of tests 😃

@leits leits closed this as completed Aug 13, 2021
@leits leits reopened this Aug 13, 2021
@leits
Copy link
Contributor Author

leits commented Aug 13, 2021

Found good examples in the repository:
https://github.com/deta/deta-python/blob/master/deta/base.py#L84-L86

@abdelhai abdelhai added the enhancement New feature or request label Aug 14, 2021
@abdelhai
Copy link
Contributor

Thanks @leits for the feedback! We will consider it in our next release. I think in general, we need to raise better errors.

@abdelhai
Copy link
Contributor

thanks Andrii! should be resolved by #69

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants