You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I understand, assert in "production" code isn't advised. This is mainly because when run in optimized mode python -0 <script.py> (or via some other means), the internal __debug__ variable is set to False and stops respecting assert statements. (See official docs: https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement)
assert is essentially:
if__debug__:
ifnotexpression: raiseAssertionError
Now, this is potentially a minor case, but if used in a production setting, it's possible that PolarRoute could be used with python's optimized mode and fall over.
Instead of assert, errors should be handled explicitly with raise (as far as I understand it).
The text was updated successfully, but these errors were encountered:
As discussed:
As far as I understand, assert in "production" code isn't advised. This is mainly because when run in optimized mode
python -0 <script.py>
(or via some other means), the internal__debug__
variable is set to False and stops respecting assert statements. (See official docs: https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement)assert is essentially:
Now, this is potentially a minor case, but if used in a production setting, it's possible that PolarRoute could be used with python's optimized mode and fall over.
Instead of
assert,
errors should be handled explicitly with raise (as far as I understand it).The text was updated successfully, but these errors were encountered: