• Complain

Zimmerman - Python Debugging Handbook

Here you can read online Zimmerman - Python Debugging Handbook full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, publisher: Independent, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Python Debugging Handbook
  • Author:
  • Publisher:
    Independent
  • Genre:
  • Year:
    2020
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Python Debugging Handbook: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Python Debugging Handbook" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

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 youre 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 theres 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 youve 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 youve already tried.Chapter 4 has simple suggestions for debugging your code, with specific examples of the code and results. Even if youve never seen Spyder or Python before, at the end of this chapter, I hope youll feel confident debugging most of the issues youll encounter.With the Debugging Overview, youll learn about the Editor, Variable Explorer, and Debug Mode and Interactive Mode in the Console. Well look at those times when you dont 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%timeitChapter 5 briefly looks at the types of errors you may encounter, and then in Chapter 6, you can try out your debugging knowledge. Well 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. Well 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.

Python Debugging Handbook — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Python Debugging Handbook" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Python Debugging RL Zimmerman Table of Contents 1 Introduction Debugging is - photo 1
Python Debugging
RL Zimmerman
Table of Contents
1. Introduction
Debugging is the process of finding and removing bugs or defects in a program. To help my daughter with her first Python class, I looked around for information on debugging that I could share with her. I wanted a simple guide with everything in one place and suggestions for how to go about the process of debugging. Initially, my research focused on gathering examples of common issues, but I knew something more was needed. After all, what happens if there is no example of the bug that youre experiencing?
I knew I needed to provide a debugging foundation. Not just how to use debugging tools, but when to take action and why. With that goal in mind, Chapters 1 through 6 build a debugging arsenal, so youre ready to tackle the examples in Chapter 7. Each example begins with References to the related topics covered in earlier chapters. So theoretically, you could jump right into the examples in Chapter 7.
This book includes an extensive and detailed Table of Contents. I also made a point to cross-reference topics so you can easily locate whatever youre interested in from any point in the material. This approach means you can pick up the book at any time and quickly jump back in where you left off. Or if you prefer, you can hop around from topic to topic with as much detail as you want.
Hopefully, after reading this book, you wont feel like this man who posted a plea for help on a chat board. His frustration shows through in his comment, For the love of God, how is this done? Instead, youll know exactly how its done and have fun doing it!
1.1 Overview
How you may ask, are we going to build your debugging arsenal? Lets begin with these topics.
How to use the debug environment.
The Python Error Codes and specific examples of how they happen.
Step-by-step instructions on the process of debugging code.
Finding the information you need to modify your program : help on Syntax, Functions, Classes, and more.
The goal of debugging is a working program, and debugging is just part of the process of writing code. When I realize I have a bug, Ill experiment and try a few things to find a clue where the issue is. Youll see this process in the examples in Chapter 7, where I use different approaches from my debugging toolbox to isolate an issue. You might take a different approach to the sample problem, and there is no wrong approach. The idea is to try a few things and see what works.
In this book, I demonstrate Python using the open-source Anaconda Data Science Distribution that includes Python version 3.7. Spyder, the Scientific Python Development Environment, comes with Anaconda. You may notice slight differences in screenshots, depending on whether I am using Spyder on my Windows or Mac computer.
1.2 What This Book is About
My intent in writing this book was not to provide a guide to Python Programming. Instead, this book is specifically about debugging Python with Anacondas Spyder application. The concepts around Python debugging apply equally to other environments, but the screens and debugging tools may vary slightly.
You may wonder why Ive included Python Basics in Chapter 3. I found it difficult to explain an IndexError without first explaining data structures and their indexes. Similarly, a Dictionary KeyError doesnt mean much without an understanding of a Dictionary. Syntax errors are fairly obvious in Spyder, but it doesnt hurt to have a brief explanation of the syntax the parser expects.
Finally, Chapter 6 demonstrates how to view values, types, and the length of objects. Since the syntax varies by the type of object, I wanted to provide a reference with the exact syntax for each object type.
1.3 Whats Next?
The next chapter walks you through installing Anaconda and the basic Spyder environment. Well also look at an overall plan for debugging code.
2. Debugging Overview
In this Chapter we discuss
Plan for Debugging
Start Small
Keep Multiple Versions of Your Code
Intended Outcome
Test Data Files
Plan for Tomorrow
Experiment
Divide and Conquer
The Debugging Environment
Python
Anaconda & Spyder
Help
Whats Next?
Writing code begins with your vision of what the program should do. You write code, see what happens, and make changes along the way. When the code doesnt do what you want, debugging helps you zero in on whats happening while the code runs. In essence, you can pause program execution and freeze your program at that point in time, looking at variable and object values at that moment.
This Chapter outlines a few suggestions to approach programming and debugging. The Examples in Chapter 7 follow a similar methodology.
Intended Outcome : What I wanted the program to do.
Actual Result : What the program did.
Incorrect Code : A look at the code before any changes.
Debugging Experiment : What I suspect is wrong with the program, and the steps I tried to debug what the program is doing.
How to Resolve the Issue : A brief description of the change to the code to achieve my Intended Outcome.
Correct Code : The finished code that works as I intended.
21 Plan for Debugging Programming is not my primary job Instead programming - photo 2
2.1 Plan for Debugging
Programming is not my primary job. Instead, programming is a tool I use for data mining or organizing projects. A day in my programming life includes lots of interruptions. It may be weeks or months before I pick up a project and continue coding. For this reason, Ive adopted a few suggestions from programming friends to make my life easier.
Work on small chunks of code, test, and then move on to the next piece.
Keep multiple backup versions of your files.
Have a clear idea of what you want your program to do.
Use small data file samples that you know have clean data to develop your code. When youve tested your code and are confident there are no bugs, use live data connections or real data files.
Keep notes of where you stopped programming and the next steps.
Start Small Write small chunks of code Test and validate that piece of code - photo 3
Start Small
Write small chunks of code. Test and validate that piece of code, then move on. This Correct Code is also a good baseline for backups.
Keep Multiple Versions of Your Code
Keep multiple backup versions of your files. My backup files often include the date and time in the filename. That way, if I really mess up the code, I can easily go back to the Correct Code that worked earlier today or last month.
Intended Outcome
While Im not suggesting you have a vision statement for your program, it doesnt hurt to have an Intended Outcome of what youre trying to accomplish. This synopsis is beneficial in several ways:
Pair programming, or asking for another opinion.
When you check-in your code to a source control program.
During peer review.
In a Sprint Review, where you demonstrate your program to others.
In case you reach out to another programmer for assistance, share as much information as possible.
The incorrect code. If you have the last working version of your code, that might also be helpful.
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Python Debugging Handbook»

Look at similar books to Python Debugging Handbook. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Python Debugging Handbook»

Discussion, reviews of the book Python Debugging Handbook and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.