| | Copyright |
| | Foreword |
| | Preface |
| | Part I: The Beginning |
| | | Chapter 1. Introducing Python |
| | | Section 1.1. "And Now for Something Completely Different" |
| | | Section 1.2. Python Philosophy 101 |
| | | Section 1.3. The Life of Python |
| | | Section 1.4. Signs of the Python Times |
| | | Section 1.5. The Compulsory Features List |
| | | Section 1.6. What's Python Good For? |
| | | Section 1.7. What's Python Not Good For? |
| | | Section 1.8. Truth in Advertising |
| | | Chapter 2. A Sneak Preview |
| | | Section 2.1. "Programming Python: The Short Story" |
| | | Section 2.2. The Task |
| | | Section 2.3. Step 1: Representing Records |
| | | Section 2.4. Step 2: Storing Records Persistently |
| | | Section 2.5. Step 3: Stepping Up to OOP |
| | | Section 2.6. Step 4: Adding Console Interaction |
| | | Section 2.7. Step 5: Adding a GUI |
| | | Section 2.8. Step 6: Adding a Web Interface |
| | | Section 2.9. The End of the Demo |
| | Part II: System Programming |
| | | Chapter 3. System Tools |
| | | Section 3.1. "The os.path to Knowledge" |
| | | Section 3.2. System Scripting Overview |
| | | Section 3.3. Introducing the sys Module |
| | | Section 3.4. Introducing the os Module |
| | | Section 3.5. Script Execution Context |
| | | Section 3.6. Current Working Directory |
| | | Section 3.7. Command-Line Arguments |
| | | Section 3.8. Shell Environment Variables |
| | | Section 3.9. Standard Streams |
| | | Chapter 4. File and Directory Tools |
| | | Section 4.1. "Erase Your Hard Drive in Five Easy Steps!" |
| | | Section 4.2. File Tools |
| | | Section 4.3. Directory Tools |
| | | Chapter 5. Parallel System Tools |
| | | Section 5.1. "Telling the Monkeys What to Do" |
| | | Section 5.2. Forking Processes |
| | | Section 5.3. Threads |
| | | Section 5.4. Program Exits |
| | | Section 5.5. Interprocess Communication |
| | | Section 5.6. Pipes |
| | | Section 5.7. Signals |
| | | Section 5.8. Other Ways to Start Programs |
| | | Section 5.9. A Portable Program-Launch Framework |
| | | Section 5.10. Other System Tools |
| | | Chapter 6. System Examples: Utilities |
| | | Section 6.1. "Splits and Joins and Alien Invasions" |
| | | Section 6.2. Splitting and Joining Files |
| | | Section 6.3. Generating Forward-Link Web Pages |
| | | Section 6.4. A Regression Test Script |
| | | Section 6.5. Packing and Unpacking Files |
| | | Section 6.6. Automated Program Launchers |
| | | Chapter 7. System Examples: Directories |
| | | Section 7.1. "The Greps of Wrath" |
| | | Section 7.2. Fixing DOS Line Ends |
| | | Section 7.3. Fixing DOS Filenames |
| | | Section 7.4. Searching Directory Trees |
| | | Section 7.5. Visitor: Walking Trees Generically |
| | | Section 7.6. Copying Directory Trees |
| | | Section 7.7. Deleting Directory Trees |
| | | Section 7.8. Comparing Directory Trees |
| | Part III: GUI Programming |
| | | Chapter 8. Graphical User Interfaces |
| | | Section 8.1. "Here's Looking at You, Kid" |
| | | Section 8.2. Python GUI Development Options |
| | | Section 8.3. Tkinter Overview |
| | | Section 8.4. Climbing the GUI Learning Curve |
| | | Section 8.5. Tkinter Coding Basics |
| | | Section 8.6. Tkinter Coding Alternatives |
| | | Section 8.7. Adding Buttons and Callbacks |
| | | Section 8.8. Adding User-Defined Callback Handlers |
| | | Section 8.9. Adding Multiple Widgets |
| | | Section 8.10. Customizing Widgets with Classes |
| | | Section 8.11. Reusable GUI Components with Classes |
| | | Section 8.12. The End of the Tutorial |
| | | Section 8.13. Python/Tkinter for Tcl/Tk Converts |
| | | Chapter 9. A Tkinter Tour, Part 1 |
| | | Section 9.1. "Widgets and Gadgets and GUIs, Oh My!" |
| | | Section 9.2. Configuring Widget Appearance |
| | | Section 9.3. Top-Level Windows |
| | | Section 9.4. Dialogs |
| | | Section 9.5. Binding Events |
| | | Section 9.6. Message and Entry |
| | | Section 9.7. Checkbutton, Radiobutton, and Scale |
| | | Section 9.8. Running GUI Code Three Ways |
| | | Section 9.9. Images |
| | | Section 9.10. Viewing and Processing Images with PIL |
| | | Chapter 10. A Tkinter Tour, Part 2 |
| | | Section 10.1. "On Today's Menu: Spam, Spam, and Spam" |
| | | Section 10.2. Menus |
| | | Section 10.3. Listboxes and Scrollbars |
| | | Section 10.4. Text |
| | | Section 10.5. Canvas |
| | | Section 10.6. Grids |
| | | Section 10.7. Time Tools, Threads, and Animation |
| | | Section 10.8. The End of the Tour |
| | | Section 10.9. The PyDemos and PyGadgets Launchers |
| | | Chapter 11. GUI Coding Techniques |
| | | Section 11.1. "Building a Better Mouse Trap" |
| | | Section 11.2. GuiMixin: Common Tool Mixin Classes |
| | | Section 11.3. GuiMaker: Automating Menus and Toolbars |
| | | Section 11.4. ShellGui: GUIs for Command-Line Tools |
| | | Section 11.5. GuiStreams: Redirecting Streams to Widgets |
| | | Section 11.6. Reloading Callback Handlers Dynamically |
| | | Section 11.7. Wrapping Up Top-Level Window Interfaces |
| | | Section 11.8. GUIs, Threads, and Queues |
| | | Section 11.9. More Ways to Add GUIs to Non-GUI Code |
| | | Chapter 12. Complete GUI Programs |
| | | Section 12.1. "Python, Open Source, and Camaros" |
| | | Section 12.2. PyEdit: A Text Editor Program/Object |
| | | Section 12.3. PyPhoto: An Image Viewer and Resizer |
| | | Section 12.4. PyView: An Image and Notes Slideshow |
| | | Section 12.5. PyDraw: Painting and Moving Graphics |
| | | Section 12.6. PyClock: An Analog/Digital Clock Widget |
| | | Section 12.7. PyToe: A Tic-Tac-Toe Game Widget |
| | | Section 12.8. Where to Go from Here |
| | Part IV: Internet Programming |
| | | Chapter 13. Network Scripting |
| | | Section 13.1. "Tune In, Log On, and Drop Out" |
| | | Section 13.2. Plumbing the Internet |
| | | Section 13.3. Socket Programming |
| | | Section 13.4. Handling Multiple Clients |
| | | Section 13.5. A Simple Python File Server |
| | | Chapter 14. Client-Side Scripting |
| | | Section 14.1. "Socket to Me!" |
| | | Section 14.2. FTP: Transferring Files over the Net |
| | | Section 14.3. Processing Internet Email |
| | | Section 14.4. POP: Fetching Email |
| | | Section 14.5. SMTP: Sending Email |
| | | Section 14.6. email: Parsing and Composing Mails |
| | | Section 14.7. pymail: A Console-Based Email Client |
| | | Section 14.8. The mailtools Utility Package |
| | | Section 14.9. NNTP: Accessing Newsgroups |
| | | Section 14.10. HTTP: Accessing Web Sites |
| | | Section 14.11. Module urllib Revisited |
| | | Section 14.12. Other Client-Side Scripting Options |
| | | Chapter 15. The PyMailGUI Client |
| | | Section 15.1. "Use the Source, Luke" |
| | | Section 15.2. A PyMailGUI Demo |
| | | Section 15.3. PyMailGUI Implementation |
| | | Chapter 16. Server-Side Scripting |
| | | Section 16.1. "Oh What a Tangled Web We Weave" |
| | | Section 16.2. What's a Server-Side CGI Script? |
| | | Section 16.3. Running Server-Side Examples |
| | | Section 16.4. Climbing the CGI Learning Curve |
| | | Section 16.5. Saving State Information in CGI Scripts |
| | | Section 16.6. The Hello World Selector |
| | | Section 16.7. Refactoring Code for Maintainability |
| | | Section 16.8. More on HTML and URL Escapes |
| | | Section 16.9. Transferring Files to Clients and Servers |
| | | Chapter 17. The PyMailCGI Server |
| | | Section 17.1. "Things to Do When Visiting Chicago" |
| | | Section 17.2. The PyMailCGI Web Site |
| | | Section 17.3. The Root Page |
| | | Section 17.4. Sending Mail by SMTP |
| | | Section 17.5. Reading POP Email |
| | | Section 17.6. Processing Fetched Mail |
| | | Section 17.7. Utility Modules |
| | | Section 17.8. CGI Script Trade-Offs |
| | | Chapter 18. Advanced Internet Topics |
| | | Section 18.1. "Surfing on the Shoulders of Giants" |
| | | Section 18.2. Zope: A Web Application Framework |
| | | Section 18.3. HTMLgen: Web Pages from Objects |
| | | Section 18.4. Jython: Python for Java |
| | | Section 18.5. Grail: A Python-Based Web Browser |
| | | Section 18.6. XML Processing Tools |
| | | Section 18.7. Windows Web Scripting Extensions |
| | | Section 18.8. Python Server Pages |
| | | Section 18.9. Rolling Your Own Servers in Python |
| | | Section 18.10. And Other Cool Stuff |
| | Part V: Tools and Techniques |
| | | Chapter 19. Databases and Persistence |
| | | Section 19.1. "Give Me an Order of Persistence, but Hold the Pickles" |
| | | Section 19.2. Persistence Options in Python |
| | | Section 19.3. DBM Files |
| | | Section 19.4. Pickled Objects |
| | | Section 19.5. Shelve Files |
| | | Section 19.6. The ZODB Object-Oriented Database |
| | | Section 19.7. SQL Database Interfaces |
| | | Section 19.8. PyForm: A Persistent Object Viewer |
| | | Chapter 20. Data Structures |
| | | Section 20.1. "Roses Are Red, Violets Are Blue; Lists Are Mutable, and So Is Set Foo" |
| | | Section 20.2. Implementing Stacks |
| | | Section 20.3. Implementing Sets |
| | | Section 20.4. Subclassing Built-In Types |
| | | Section 20.5. Binary Search Trees |
| | | Section 20.6. Graph Searching |
| | | Section 20.7. Reversing Sequences |
| | | Section 20.8. Permuting Sequences |
| | | Section 20.9. Sorting Sequences |
| | | Section 20.10. Data Structures Versus Python Built-Ins |
| | | Section 20.11. PyTree: A Generic Tree Object Viewer |
| | | Chapter 21. Text and Language |
| | | Section 21.1. "See Jack Hack. Hack, Jack, Hack" |
| | | Section 21.2. Strategies for Parsing Text in Python |
| | | Section 21.3. String Method Utilities |
| | | Section 21.4. Regular Expression Pattern Matching |
| | | Section 21.5. Advanced Language Tools |
| | | Section 21.6. Handcoded Parsers |
| | | Section 21.7. PyCalc: A Calculator Program/Object |
| | Part VI: Integration |
| | | Chapter 22. Extending Python |
| | | Section 22.1. "I Am Lost at C" |
| | | Section 22.2. Integration Modes |
| | | Section 22.3. C Extensions Overview |
| | | Section 22.4. A Simple C Extension Module |
| | | Section 22.5. Extension Module Details |
| | | Section 22.6. The SWIG Integration Code Generator |
| | | Section 22.7. Wrapping C Environment Calls |
| | | Section 22.8. A C Extension Module String Stack |
| | | Section 22.9. A C Extension Type String Stack |
| | | Section 22.10. Wrapping C++ Classes with SWIG |
| | | Section 22.11. Other Extending Tools |
| | | Chapter 23. Embedding Python |
| | | Section 23.1. "Add Python. Mix Well. Repeat." |
| | | Section 23.2. C Embedding API Overview |
| | | Section 23.3. Basic Embedding Techniques |
| | | Section 23.4. Registering Callback Handler Objects |
| | | Section 23.5. Using Python Classes in C |
| | | Section 23.6. A High-Level Embedding API: ppembed |
| | | Section 23.7. Other Integration Topics |
| | Part VIII: The End |
| | | Chapter 24. Conclusion: Python and the Development Cycle |
| | | Section 24.1. "That's the End of the Book, Now Here's the Meaning of Life" |
| | | Section 24.2. "Something's Wrong with the Way We Program Computers" |
| | | Section 24.3. The "Gilligan Factor" |
| | | Section 24.4. Doing the Right Thing |
| | | Section 24.5. Enter Python |
| | | Section 24.6. But What About That Bottleneck? |
| | | Section 24.7. On Sinking the Titanic |
| | | Section 24.8. So What's "Python: The Sequel"? |
| | | Section 24.9. In the Final Analysis . . . |
| | | Section 24.10. Postscript to the Second Edition (2000) |
| | | Section 24.11. Postscript to the Third Edition (2006) |
| | About the Author |
| | Colophon |
| | Index |