Learning Python: Powerful Object-Oriented Programming

Learning Python

Preface

     About This Book

     Font Conventions

     About the Programs in This Book

     How to Contact Us

     Acknowledgments

I: The Core Language

1. Getting Started

     1.1 Why Python?

     1.2 How to Run Python Programs

     1.3 A First Look at Module Files

     1.4 Python Configuration Details

     1.5 Summary

     1.6 Exercises

2. Types and Operators

     2.1 Python Program Structure

     2.2 Why Use Built-in Types?

     2.3 Numbers

     2.4 Strings

     2.5 Lists

     2.6 Dictionaries

     2.7 Tuples

     2.8 Files

     2.9 General Object Properties

     2.10 Built-in Type Gotchas

     2.11 Summary

     2.12 Exercises

3. Basic Statements

     3.1 Assignment

     3.2 Expressions

     3.3 Print

     3.4 if Tests

     3.5 while Loops

     3.6 for Loops

     3.7 Common Coding Gotchas

     3.8 Summary

     3.9 Exercises

4. Functions

     4.1 Why Use Functions?

     4.2 Function Basics

     4.3 Scope Rules in Functions

     4.4 Argument Passing

     4.5 Odds and Ends

     4.6 Function Gotchas

     4.7 Summary

     4.8 Exercises

5. Modules

     5.1 Why Use Modules?

     5.2 Module Basics

     5.3 Module Files Are Namespaces

     5.4 Import Model

     5.5 Reloading Modules

     5.6 Odds and Ends

     5.7 Module Gotchas

     5.8 Summary

     5.9 Exercises

6. Classes

     6.1 Why Use Classes?

     6.2 Class Basics

     6.3 Using the Class Statement

     6.4 Using Class Methods

     6.5 Inheritance Searches Namespace Trees

     6.6 Operator Overloading in Classes

     6.7 Namespace Rules: The Whole Story

     6.8 Designing with Classes

     6.9 Odds and Ends

     6.10 Class Gotchas

     6.11 Summary

     6.12 Exercises

7. Exceptions

     7.1 Why Use Exceptions?

     7.2 Exception Basics

     7.3 Exception Idioms

     7.4 Exception Catching Modes

     7.5 Odds and Ends

     7.6 Exception Gotchas

     7.7 Summary

     7.8 Exercises

II: The Outer Layers

8. Built-in Tools

     8.1 Aside: The sys Module

     8.2 Built-in Functions

     8.3 Library Modules

     8.4 Exercises

9. Common Tasks in Python

     9.1 Data Structure Manipulations

     9.2 Manipulating Files

     9.3 Manipulating Programs

     9.4 Internet-Related Activities

     9.5 Bigger Examples

     9.6 Exercises

10. Frameworks and Applications

     10.1 An Automated Complaint System

     10.2 Interfacing with COM: Cheap Public Relations

     10.3 A Tkinter-Based GUI Editor for Managing Form Data

     10.4 Design Considerations

     10.5 JPython: The Felicitous Union of Python and Java

     10.6 Other Frameworks and Applications

     10.7 Exercises

III: Appendixes

A. Python Resources

     A.1 The Python Language Web Site

     A.2 Python Software

     A.3 Python Documentation and Books

     A.4 Newsgroups, Discussion Groups, and Email Help

     A.5 Conferences

     A.6 Support Companies, Consultants, Training

     A.7 Tim Peters

B. Platform-Specific Topics

     B.1 Unix

     B.2 Windows-Specific Information

     B.3 Macintosh-Specific Information

     B.4 Java

     B.5 Other Platforms

C. Solutions to Exercises

     C.1 Chapter 1

     C.2 Chapter 2

     C.3 Chapter 3

     C.4 Chapter 4

     C.5 Chapter 5

     C.6 Chapter 6

     C.7 Chapter 7

     C.8 Chapter 8

     C.9 Chapter 9

     C.10 Chapter 10

Colophon

Категории