Python: how to identify error location? Honestly, I just use `print()` but in a smarter way.
Instead of dumping random values, I label them like `print("DEBUG - line 42, x is:", x)`. Makes it easier to grep through later.
But if you want something fancier, `icecream` (`pip install icecream`) is a game-changer. Just `ic(variable)` and it prints the variable name *and* value.
Also, `%debug` in IPython after an error drops you into a post-mortem debugger. Magic.
Instead of dumping random values, I label them like `print("DEBUG - line 42, x is:", x)`. Makes it easier to grep through later.
But if you want something fancier, `icecream` (`pip install icecream`) is a game-changer. Just `ic(variable)` and it prints the variable name *and* value.
Also, `%debug` in IPython after an error drops you into a post-mortem debugger. Magic.
