I find myself using a "splatter then clean up" technique when working with code. I add a ton of prints/logs/asserts/type annotations until I've found the issue. I then throw them all away! It feels like redundant work, but I don't have a nicer solution.