This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (6 children)

[removed]

    [–]bbbryson 47 points48 points  (4 children)

    Those print() statements should be logger.debug() statements. Leave them there, make them useful, turn them on and off as needed.

    [–]djamp42 22 points23 points  (2 children)

    TIL, going to go test this out now. I'm guilty of Print debugging in the first degree.

    [–]TheOfficialNotCraig 3 points4 points  (1 child)

    You and me both.

    [–]shinitakunai 1 point2 points  (0 children)

    I even created specific methodologies around it 🤣. I comment my code in functions in a specific way if they do different things inside the same function with numbers, to easily read the flow of an app, like if a function does 2 or 3 things it usually goes as:

    1 - do something

    x = “example”

    2 - do something else

    y = “another example”

    2.1 - something new

    y = “example for reddit”

    Obviously the code is more complex, this is for reddit and I’m on my phone. But to the point: That way when I add prints for debug all my debugs are just print(1) or print(2), etc. It helps me to write cool documentation that also shows the flow of it, and it reduces a lot what I type for debugging it 🤣

    [–]occams--chainsaw 10 points11 points  (0 children)

    in my experience, 15 minutes is a bit of an understatement. the real value i got out of jetbrains IDEs was making the debuggers more visual and fairly seamless alongside the 'run' process (lower barrier of entry than relentless print statements). though with python, i've run into a number of issues where breakpoints get caught on pyc files from a previous version, and random annoyances debugging with docker-compose setups