Python Debugging Handbook

Python Debugging Handbook

This book is a systematic plan to debug your programs. The focus is not on the Python language, although Chapter 3 does cover the basics. Instead, my focus is always on debugging. If you’re new to Python debugging, I think this book is a good starting point. Experienced Python programmers might want to review the table of contents to see if there’s anything special that catches their interest.

The sample code demonstrates lists, tuples, loops, or classes, but in the simplest form I could imagine. 

Chapters 1-2 outline how to set up your Python debugging environment, and establish a debugging plan as you write your code.
1. Work on small chunks of code, test, and then move on to the next piece.
2. Keep multiple backup versions of your files.
3. Have a clear idea of what you want your program to do.
4. Use small data file samples that you know have clean data to develop your code. When you’ve tested your code and are confident there are no bugs, use live data connections or real data files. 
5. Keep notes of where you stopped programming and the next steps.
6. Divide and concur. Divide the code in half and test each half to see which half has the error. Repeat to drill down to the location with the error.
7. When debugging, keep a record of experiments, so you know what you’ve already tried.
Chapter 4 has simple suggestions for debugging your code, with specific examples of the code and results. Even if you’ve never seen Spyder or Python before, at the end of this chapter, I hope you’ll feel confident debugging most of the issues you’ll encounter.

• With the Debugging Overview, you’ll learn about the Editor, Variable Explorer, and Debug Mode and Interactive Mode in the Console. We’ll look at those times when you don’t see your object in Variable Explorer, and explore why the Console traceback says “NameError.”
• Delve into Debug Mode, including basic commands, how to set a breakpoint, and examples of stepping through the code.
• Add Print Statements (and visual clues for the depth of loop statements).
• Logging for those times when print statements roll off the screen.
• Use Interactive Mode with several common Console commands and two magic commands. 

[object name]?
dir(object)
help(object)
%debug
%timeit
Chapter 5 briefly looks at the types of errors you may encounter, and then in Chapter 6, you can try out your debugging knowledge. We’ll look at the syntax for retrieving object values, type information, the length of objects or data structures, arguments, and return values. Because syntax varies based on the type and length of objects, there are numerous examples for strings, numbers, tuples, lists, and dictionaries. We’ll also look at the special “None” value, unique to Python.

Chapter 7 is chock full of examples. The format for each example is the same: Description, Intended Outcome, Actual Result, Incorrect Code, Debugging Steps, How to Resolve the Issue, Good Code, and a Reference to earlier related topics.

Finally, the Appendix-Reference chapter includes links to the Python.org docs and the iPython.readthedocs websites for more detailed information.

Download Now Read Online

Python Debugging Handbook


Python Debugging Handbook Download Now Read Online

Author by : R L Zimmerman
Languange Used : en
Release Date : 2020-02-07
Publisher by :






Python Data Science Handbook


Python Data Science Handbook Download Now Read Online

Author by : Jake VanderPlas
Languange Used : en
Release Date : 2016-11-21
Publisher by : "O'Reilly Media, Inc."






Python Data Science Handbook


Python Data Science Handbook Download Now Read Online

Author by : Jake VanderPlas
Languange Used : en
Release Date : 2016-11-21
Publisher by : "O'Reilly Media, Inc."






Python Recipes Handbook


Python Recipes Handbook Download Now Read Online

Author by : Joey Bernard
Languange Used : en
Release Date : 2016-11-08
Publisher by : Apress






The Hitchhiker S Guide To Python


The Hitchhiker S Guide To Python Download Now Read Online

Author by : Kenneth Reitz
Languange Used : en
Release Date : 2016-08-30
Publisher by : "O'Reilly Media, Inc."






Handbook Of Object Technology


Handbook Of Object Technology Download Now Read Online

Author by : Saba Zamir
Languange Used : en
Release Date : 1998-12-18
Publisher by : CRC Press






Software Exorcism


Software Exorcism Download Now Read Online

Author by : Bill Blunden
Languange Used : en
Release Date : 2008-01-01
Publisher by : Apress






Leave a Reply

Your email address will not be published. Required fields are marked *