Sometimes, building / running / doing the flow that produces a bug takes a lot of time. Or the bug is in external lib which would make it hard / cumbersome to instrument with logs. In that case, properly placed debugger will save a lot of time.
If things are easy to isolate, print is faster.
For the next level printing though, do not use
print('here1')
print('here2')
But instead write meaningful logs, say
print('copying X')
print('zipping to X.zip')
print('uploading to Y')
which can stay after you're done debugging. (Ideally you should not use print directly but via an util which silences the logs depending on program params, or removes them at build time etc.)
I'm mind blown how big % of code I work with has zero logs and zero comments. Whenever something crashes and the author is not around, good luck.
If things are easy to isolate, print is faster.
For the next level printing though, do not use
But instead write meaningful logs, say which can stay after you're done debugging. (Ideally you should not use print directly but via an util which silences the logs depending on program params, or removes them at build time etc.)I'm mind blown how big % of code I work with has zero logs and zero comments. Whenever something crashes and the author is not around, good luck.