Use of assert
statements
#620
Replies: 2 comments
-
I can see some different cases here. To begin with I can see some I'd suggest a pull request that (1) initially removes all the We can take a look at other cases after that. |
Beta Was this translation helpful? Give feedback.
-
That will appease mypy while also giving you the benefit of raising an error at runtime if the expectation isn't met, which possibly allows you to make the change in one step. |
Beta Was this translation helpful? Give feedback.
-
I've noticed a number of
assert
statements within this codebase, which aren't recommended for production code because they can be disabled by running Python in optimized mode or with__debug__ = False
. This can be a security risk because it can expose code that wouldn't have otherwise run.Is there a reason why
assert
is being used instead of anif
statement with araise
for an exception?Beta Was this translation helpful? Give feedback.
All reactions