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
Any respectable compiler has options for levels of code optimalisation and / or debug mode, that can disable assert statements. The assert statements are very powerful tools for debugging and sanity checking.
Python's default assert disabling options are very cumbersome for the typical REPL / Jupyter notebook data science workflow, since assert statements cannot be disabled / enabled during runtime at will. However for pure python, it does not present too much problem, because of the REPL capability of the language. Though even for pure python it would be good to be able to disable assert statements at will.
For compiled code, asserts are vital for debugging. Hence it would be nice to have a debug option to disable assert statements in the numba jit-ed code, after the debugging process is finished.
The text was updated successfully, but these errors were encountered:
kalocsaibotond
changed the title
assert option disabling for numba jit compilationassert debug option disabling for numba jit compilation
May 3, 2024
kalocsaibotond
changed the title
assert debug option disabling for numba jit compilationassert disabling debug option for numba jit compilation
May 3, 2024
I am aware of the existence of these command line options. However, the problem with these options that they are not changeable during a python session.
So if someone is doing data science in a jupyter notebook or in an ipython REPL, then one has to kill the whole session restart for debug.
This is why it is so frustrating to use assert in python. Leaving in assert with complicated condition can yield significant performance loss. Implementing additional debug branching like
if debug:
assert complicated_condition "Complicated condition is violated."
, where debug is a global bool variable, still incur a pointless if evaluation and less readable.
Nevertheless, living in dynamically typed interpreted language without assert is feasible. However, things get quickly frustrating in a statically typed, "compiled" language without assert, such as numba jit-ed python.
Feature request
Any respectable compiler has options for levels of code optimalisation and / or debug mode, that can disable
assert
statements. Theassert
statements are very powerful tools for debugging and sanity checking.Python's default
assert
disabling options are very cumbersome for the typical REPL / Jupyter notebook data science workflow, since assert statements cannot be disabled / enabled during runtime at will. However for pure python, it does not present too much problem, because of the REPL capability of the language. Though even for pure python it would be good to be able to disableassert
statements at will.For compiled code, asserts are vital for debugging. Hence it would be nice to have a debug option to disable
assert
statements in the numba jit-ed code, after the debugging process is finished.The text was updated successfully, but these errors were encountered: