Dedication;Preface; About This Third Edition; About This Book; Book Updates; About the Programs in This Book; Preparing for Python 3.0; About This Series; Using Code Examples; Font Conventions; SafariĀ® Books Online; How to Contact Us; Acknowledgments;Getting Started; Chapter 1: A Python Q&A Session; 1.1 Why Do People Use Python?; 1.2 Is Python a "Scripting Language"?; 1.3 OK, but What''s the Downside?; 1.4 Who Uses Python Today?; 1.5 What Can I Do with Python?; 1.6 What Are Python''s Technical Strengths?; 1.
7 How Does Python Stack Up to Language X?; 1.8 Chapter Summary; Chapter 2: How Python Runs Programs; 2.1 Introducing the Python Interpreter; 2.2 Program Execution; 2.3 Execution Model Variations; 2.4 Chapter Summary; Chapter 3: How You Run Programs; 3.1 Interactive Coding; 3.2 System Command Lines and Files; 3.
3 Clicking File Icons; 3.4 Module Imports and Reloads; 3.5 The IDLE User Interface; 3.6 Other IDEs; 3.7 Embedding Calls; 3.8 Frozen Binary Executables; 3.9 Text Editor Launch Options; 3.10 Other Launch Options; 3.
11 Future Possibilities?; 3.12 Which Option Should I Use?; 3.13 Chapter Summary; 3.14 BRAIN BUILDER;Types and Operations; Chapter 4: Introducing Python Object Types; 4.1 Why Use Built-in Types?; 4.2 Numbers; 4.3 Strings; 4.4 Lists; 4.
5 Dictionaries; 4.6 Tuples; 4.7 Files; 4.8 Other Core Types; 4.9 Chapter Summary; Chapter 5: Numbers; 5.1 Python Numeric Types; 5.2 Python Expression Operators; 5.3 Numbers in Action; 5.
4 Other Numeric Types; 5.5 Chapter Summary; Chapter 6: The Dynamic Typing Interlude; 6.1 The Case of the Missing Declaration Statements; 6.2 Shared References; 6.3 Dynamic Typing Is Everywhere; 6.4 Chapter Summary; Chapter 7: ofsmallStrings; 7.1 String Literals; 7.2 Strings in Action; 7.
3 String Formatting; 7.4 String Methods; 7.5 General Type Categories; 7.6 Chapter Summary; Chapter 8: Lists and Dictionaries; 8.1 Lists; 8.2 Lists in Action; 8.3 Dictionaries; 8.4 Dictionaries in Action; 8.
5 Chapter Summary; Chapter 9: Tuples, Files, and Everything Else; 9.1 Tuples; 9.2 Files; 9.3 Type Categories Revisited; 9.4 Object Flexibility; 9.5 References Versus Copies; 9.6 Comparisons, Equality, and Truth; 9.7 Python''s Type Hierarchies; 9.
8 Other Types in Python; 9.9 Built-in Type Gotchas; 9.10 Chapter Summary; 9.11 BRAIN BUILDER;Statements and Syntax; Chapter 10: Introducing Python Statements; 10.1 Python Program Structure Revisited; 10.2 A Tale of Two ifs; 10.3 A Quick Example: Interactive Loops; 10.4 Chapter Summary; Chapter 11: rwordsAssignment, Expressions, and print; 11.
1 Assignment Statements; 11.2 Expression Statements; 11.3 print Statements; 11.4 Chapter Summary; Chapter 12: if Tests; 12.1 if Statements; 12.2 Python Syntax Rules; 12.3 Truth Tests; 12.4 Chapter Summary; Chapter 13: while and for Loops; 13.
1 while Loops; 13.2 break, continue, pass, and the Loop else; 13.3 for Loops; 13.4 Iterators: A First Look; 13.5 Loop Coding Techniques; 13.6 List Comprehensions: A First Look; 13.7 Chapter Summary; Chapter 14: The Documentation Interlude; 14.1 Python Documentation Sources; 14.
2 Common Coding Gotchas; 14.3 Chapter Summary; 14.4 BRAIN BUILDER;Functions; Chapter 15: Function Basics; 15.1 Why Use Functions?; 15.2 A First Example: Definitions and Calls; 15.3 A Second Example: Intersecting Sequences; 15.4 Chapter Summary; Chapter 16: Scopes and Arguments; 16.1 Scope Rules; 16.
2 The global Statement; 16.3 Scopes and Nested Functions; 16.4 Passing Arguments; 16.5 Special Argument-Matching Modes; 16.6 Chapter Summary; Chapter 17: Advanced Function Topics; 17.1 Anonymous Functions: lambda; 17.2 Applying Functions to Arguments; 17.3 Mapping Functions over Sequences: map; 17.
4 Functional Programming Tools: filter and reduce; 17.5 List Comprehensions Revisited: Mappings; 17.6 Iterators Revisited: Generators; 17.7 Timing Iteration Alternatives; 17.8 Function Design Concepts; 17.9 Function Gotchas; 17.10 Chapter Summary; 17.11 BRAIN BUILDER;Modules; Chapter 18: Modules: The Big Picture; 18.
1 Why Use Modules?; 18.2 Python Program Architecture; 18.3 How Imports Work; 18.4 Chapter Summary; Chapter 19: Module Coding Basics; 19.1 Module Creation; 19.2 Module Usage; 19.3 Module Namespaces; 19.4 Reloading Modules; 19.
5 Chapter Summary; Chapter 20: Module Packages; 20.1 Package Import Basics; 20.2 Package Import Example; 20.3 Why Use Package Imports?; 20.4 Chapter Summary; Chapter 21: Advanced Module Topics; 21.1 Data Hiding in Modules; 21.2 Enabling Future Language Features; 21.3 Mixed Usage Modes: _ _name_ _ and _ _main_ _; 21.
4 Changing the Module Search Path; 21.5 The import as Extension; 21.6 Relative Import Syntax; 21.7 Module Design Concepts; 21.8 Module Gotchas; 21.9 Chapter Summary; 21.10 BRAIN BUILDER;Classes and OOP; Chapter 22: OOP: The Big Picture; 22.1 Why Use Classes?; 22.
2 OOP from 30,000 Feet; 22.3 Chapter Summary; Chapter 23: Class Coding Basics; 23.1 Classes Generate Multiple Instance Objects; 23.2 Classes Are Customized by Inheritance; 23.3 Classes Can Intercept Python Operators; 23.4 The World''s Simplest Python Class; 23.5 Chapter Summary; Chapter 24: Class Coding Details; 24.1 The class Statement; 24.
2 Methods; 24.3 Inheritance; 24.4 Operator Overloading; 24.5 Namespaces: The Whole Story; 24.6 A More Realistic Example; 24.7 Chapter Summary; Chapter 25: Designing with Classes; 25.1 Python and OOP; 25.2 Classes As Records; 25.
3 OOP and Inheritance: "Is-a" Relationships; 25.4 OOP and Composition: "Has-a" Relationships; 25.5 OOP and Delegation; 25.6 Multiple Inheritance; 25.7 Classes Are Objects: Generic Object Factories; 25.8 Methods Are Objects: Bound or Unbound; 25.9 Documentation Strings Revisited; 25.10 Classes Versus Modules; 25.
11 Chapter Summary; Chapter 26: Advanced Class Topics; 26.1 Extending Built-in Types; 26.2 Pseudoprivate Class Attributes; 26.3 New-Style Classes; 26.4 Static and Class Methods; 26.5 Function Decorators; 26.6 Class Gotchas; 26.7 Chapter Summary; 26.
8 BRAIN BUILDER;Exceptions and Tools; Chapter 27: Exception Basics; 27.1 Why Use Exceptions?; 27.2 Exception Handling: The Short Story; 27.3 The try/except/else Statement; 27.4 The try/finally Statement; 27.5 Unified try/except/finally; 27.6 The raise Statement; 27.7 The assert Statement; 27.
8 with/as Context Managers; 27.9 Chapter Summary; Chapter 28: Exception Objects; 28.1 String-Based Exceptions; 28.2 Class-Based Exceptions; 28.3 General raise Statement Forms; 28.4 Chapter Summary; Chapter 29: Designing with Exceptions; 29.1 Nesting Exception Handlers; 29.2 Exception Idioms; 29.
3 Exception Design Tips; 29.4 Exception Gotchas; 29.5 Core Language Summary; 29.6 Chapter Summary; 29.7 BRAIN BUILDER;Appendixes; Installation and Configuration; Installing the Python Interpreter; Configuring Python; Solutions to End-of-Part Exercises; Part I, Getting Started; Part II, Types and Operations; Part III, Statements and Syntax; Part IV, Functions; Part V, Modules; Part VI, Classes and OOP; Part VII, Exceptions and Tools;Colophon;.