Debugging

How do you other python users handle debugging. I’m currently just sticking print statements all over the shot but that doesn’t scale to larger programs well.
I’m aware of Try except but not sure how they can help without knowing your problem to start with.
Basicly I’m tired of spending three times as long debugging than programming and am looking for a solution.
Thanks

I usually create a function called “outputText” and use that instead of print. Then I put an if statement in outputText so I can turn off debugging print statements when I’m done. But you are doing the right thing. Just a bunch of print statements.


def outputText(passedText):
    if OUTPUTTEXT: print passedText

Some rules I try to follow:
Do not wrap things in try/except until the end. As you may have discovered this will simply hide errors during development.
Always, did I say ALWAYS check for None and return values.
Always write a companion ELSE for every single IF statement.
And last, but not least, imagine the inventor of Python, the guy who decided that indentation errors would be cool. And picture your hands around his neck! Squeeze hard with your imagination till you get your fill.