#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    78
    Rep Power
    2

    So, how do you guys debug?


    Whats your favorite way of debugging a python program?
    print statements? logging? adding more unit tests? jump to an interactive interpreter in the middle of your program? Is there anything I haven't mentioned here you feel need mentioning?
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    610
    Rep Power
    65
    Temporary print() solve about 80% of my foolish bugs.
    For some more hidden bugs I use Winpdb.
    Last edited by Dietrich; May 30th, 2013 at 10:24 AM.
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    UK
    Posts
    1
    Rep Power
    0
    Trace tables can be helpful.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Usually Japan when not on contract
    Posts
    240
    Rep Power
    12
    Temporary print -- big win. Refactoring anything that isn't obviously correct -- even bigger win on Real Bugs.

    The refactoring bit is really a two-pronged attack: it unravels Heisenbugs by killing the complexity hidden in places you've outsmarted yourself, and once the tricky bits have been reduced to tiny components then testing actually has a tiny chance of providing rigorous proof that the components are correct. But usually testing like that is overkill -- tiny components are usually obvious components.

    Restructuring so that global complexity is at least sliced up into orthogonal units makes debugging easy, but it requires a pretty different design methodology than I see in most projects.

    Comments on this post

    • b49P23TIvg agrees
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    28
    Rep Power
    0
    I'm still a beginner but using print statements helps me greatly
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    114
    Rep Power
    3
    Some combination of prints, screwing around at the REPL, and staring at the code usually works for me. I use a real debugger occasionally.

IMN logo majestic logo threadwatch logo seochat tools logo