Go to main content
Formats
Format
BibTeX
MARCXML
TextMARC
MARC
DublinCore
EndNote
NLM
RefWorks
RIS
Cite

Linked e-resources

Details

At a Glance; Contents; About the Author; About the Technical Reviewer; Acknowledgments; Preface; Chapter 1: Introduction; A Lesson in Humility; The Case for Best Practices in Python; The Origin of Best Practices; Hacking; Software Engineering; Agile; Software Craftsmanship; Who This Book Is For; What This Book Is About; Part 1: Debugging; Part 2: Automated Testing; Part 3: Maintenance; Further Benefits; The MazeRun Game; How to Use This Book?; Install Python 3; Install the Pygame Library; Install a Text Editor; Download the Source Code Examples; Part I: Debugging

Chapter 2: Exceptions in PythonExceptions Are Defects We Know About; Reading the Code; SyntaxError; Best Practices for Debugging SyntaxErrors; Examining the Error Message; The Error Type; The Error Description; The Traceback; Deduction; Catching Exceptions; Best Practices for Debugging IOErrors; Errors and Defects; Where Do Defects Come From?; The Correct Code; Best Practices; Chapter 3: Semantic Errors in Python; Comparing Expected and Factual Output; Defects; Defects in Variable Assignments; Multiple Initialization; Accidental Assignment; Accidental Comparison

Wrong Variables in an ExpressionSwapped Literals in Expression; Defects in Indexing; Creating Wrong Indices; Using Wrong Indices; Defects in Control Flow Statements; Defects in Boolean Expressions; Defects with Indentation; Defects in Using Functions; Omitting a Function Call; Missing Return Statement; Not Storing the Return Value; Error Propagation; Best Practices; Chapter 4: Debugging with the Scientific Method; Applying the Scientific Method; Reproducing the Error; Automating the Error; Isolating the Defect; The Strip-Down Strategy; The Binary Search Strategy; Getting Help; Taking a Break

Explain the Problem to Someone ElsePair Programming; Code Reviews; Reading; Cleaning Up; The Scientific Method and Other Best Practices; Best Practices; Chapter 5: Debugging with print Statements; Diagnose Whether Code Was Executed; Print the Content of Variables; Pretty-Printing Data Structures; Simplify Input Data; Start with Minimal Input; Gradually Add More Input Data; Switching print Output On and Off; Complete Code; Pros and Cons of Using print Statements; Best Practices; Chapter 6: Debugging with Introspection Functions; Explorative Coding in IPython; Exploring Files and Directories

Overview of IPython CommandsExploring Namespaces; Exploring Namespaces with dir(); Exploring Namespaces of Objects; Exploring Attributes in a Python Program; Alternatives to dir in IPython; Namespace Mechanics; Python Uses Namespaces for Its Own Functions; Modifying a Namespace; Namespaces and Local Scope; Namespaces Are a Core Feature of Python; Using Self-Documenting Objects; Accessing Docstrings with help(); Object Summaries in IPython; Analyzing Object Types; Checking Object Identity; Checking Instances and Subclasses; Practical Use of Introspection; Finding Typos with Introspection

Browse Subjects

Show more subjects...

Statistics

from
to
Export