Re:Icecream: Never use print() to debug again in Python
by Macha on Tuesday March 30, 2021 @09:44AM
(#26634532)
Yes, print() and breakpoints are different tools with different uses and there's cases where one is superior to the other. This is why some tools now offer logpoints, which are basically print() inserted via a breakpoint UI rather than in your code where you can forget to remove them
Re:Icecream: Never use print() to debug again in Python
by kyawzazaw on Tuesday March 30, 2021 @11:50AM
(#26636065)
Oh please tell me about those tools.
Re:Icecream: Never use print() to debug again in Python
by maccard on Tuesday March 30, 2021 @12:39PM
(#26636845)
Visual studio does trace points [0]
[0] https://docs.microsoft.com/en-us/visualstudio/debugger/using...
Re:Icecream: Never use print() to debug again in Python
by Macha on Tuesday March 30, 2021 @11:54AM
(#26636139)
VS Code and Firefox Developer Tools are the two I'm aware of with actual support. Also some tools you can adhoc it as a conditional breakpoint by basically putting "print(whatever); return false" as the condition
Re:Icecream: Never use print() to debug again in Python
by maccard on Tuesday March 30, 2021 @12:48PM
(#26636987)
> the cost of using print is extremely small, smaller at least than breakpoints.
I don't think it is, at all. The cost of using print is re-running your applciation with a code change, whereas the cost of a breakpoint is re-running your application with a breakpoint. Clicking in a gutter in an editor, pressing a keyboard shortcut, or typing "b <line number>" into your debugger is no more time or effort than adding a print statement, and re-running your program.
No one is saying breakpoints are useless, sometimes printing is 'cheaper' in time and effort in order to locate the region code of code in which using breakpoints is cheaper.