Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjohnathanmyers
19,994 PointsI would think that it is still better to put import pdb at the top of the script...
I would think that it is still better to put import pdb at the top of the script so that in the situation that you forgot to remove it other developers could easily see that the pdb was used and they could then remove it. Otherwise they would have to search through all the code for it or run a find and replace.
3 Answers
Kenneth Love
Treehouse Guest TeacherSure. But since you're usually going to remove it right after you get through checking something, having the import and the use side-by-side makes the removal a lot faster and easier.
Ron Fisher
5,752 PointsJohnathan,
I've also done the following for debugging parts throughout a long group project.
At the top put: debug = 1
Down in the code: if debug: import pdb
I've also had different levels of a debug defined by larger integers. That way you don't have to change the code, except for the debug on the top, and the debugging is turned on and off either by a boolean or by integer value and module.
Ron
MUZ140953 Herbert Samuriwo
7,929 Pointsimport pdb; pdb.set_trace()
THIS ONE WORKS FOR ME
Thanks KENNETH for teach me these things