|
 |
Copyright |
|
 |
Foreword |
|
 |
Preface |
|
|
 |
"And Now for Something Completely Different . . . Again" |
|
|
 |
Signs of the Python Times |
|
|
 |
Why This Edition? |
|
|
 |
Major Changes in This Edition |
|
|
 |
Using the Examples and Demos |
|
|
 |
Conventions Used in This Book |
|
|
 |
Where to Look for Updates |
|
|
 |
Contacting O'Reilly |
|
|
 |
Acknowledgments |
|
|
 |
Chapter 1.
Introducing Python |
|
|
 |
Section 1.1.
"And Now for Something Completely Different" |
|
|
 |
Section 1.2.
The Life of Python |
|
|
 |
Section 1.3.
The Compulsory Features List |
|
|
 |
Section 1.4.
What's Python Good For? |
|
|
 |
Section 1.5.
What's Python Not Good For? |
|
|
 |
Part I:
System Interfaces |
|
|
 |
Chapter 2.
System Tools |
|
|
 |
Section 2.1.
"The os.path to Knowledge" |
|
|
 |
Section 2.2.
Why Python Here? |
|
|
 |
Section 2.3.
System Scripting Overview |
|
|
 |
Section 2.4.
The sys Module |
|
|
 |
Section 2.5.
The os Module |
|
|
 |
Section 2.6.
Script Execution Context |
|
|
 |
Section 2.7.
Current Working Directory |
|
|
 |
Section 2.8.
Command-Line Arguments |
|
|
 |
Section 2.9.
Shell Environment Variables |
|
|
 |
Section 2.10.
Standard Streams |
|
|
 |
Section 2.11.
File Tools |
|
|
 |
Section 2.12.
Directory Tools |
|
|
|
 |
Chapter 3.
Parallel System Tools |
|
|
 |
Section 3.1.
"Telling the Monkeys What to Do" |
|
|
 |
Section 3.2.
Forking Processes |
|
|
 |
Section 3.3.
Threads |
|
|
 |
Section 3.4.
Program Exits |
|
|
 |
Section 3.5.
Interprocess Communication |
|
|
 |
Section 3.6.
Pipes |
|
|
 |
Section 3.7.
Signals |
|
|
 |
Section 3.8.
Launching Programs on Windows |
|
|
 |
Section 3.9.
Other System Tools |
|
|
|
 |
Chapter 4.
Larger System Examples I |
|
|
 |
Section 4.1.
"Splits and Joins and Alien Invasions" |
|
|
 |
Section 4.2.
Splitting and Joining Files |
|
|
 |
Section 4.3.
Generating Forward-Link Web Pages |
|
|
 |
Section 4.4.
A Regression Test Script |
|
|
 |
Section 4.5.
Packing and Unpacking Files |
|
|
 |
Section 4.6.
User-Friendly Program Launchers |
|
|
|
 |
Chapter 5.
Larger System Examples II |
|
|
 |
Section 5.1.
"The Greps of Wrath" |
|
|
 |
Section 5.2.
Fixing DOS Line Ends |
|
|
 |
Section 5.3.
Fixing DOS Filenames |
|
|
 |
Section 5.4.
Searching Directory Trees |
|
|
 |
Section 5.5.
Visitor: Walking Trees Generically |
|
|
 |
Section 5.6.
Copying Directory Trees |
|
|
 |
Section 5.7.
Deleting Directory Trees |
|
|
 |
Section 5.8.
Comparing Directory Trees |
|
|
|
 |
Part II:
GUI Programming |
|
|
 |
Chapter 6.
Graphical User Interfaces |
|
|
 |
Section 6.1.
"Here's Looking at You, Kid" |
|
|
 |
Section 6.2.
Python GUI Development Options |
|
|
 |
Section 6.3.
Tkinter Overview |
|
|
 |
Section 6.4.
Climbing the GUI Learning Curve |
|
|
 |
Section 6.5.
The End of the Tutorial |
|
|
 |
Section 6.6.
Python/Tkinter for Tcl/Tk Converts |
|
|
|
 |
Chapter 7.
A Tkinter Tour, Part 1 |
|
|
 |
Section 7.1.
"Widgets and Gadgets and GUIs, Oh My!" |
|
|
 |
Section 7.2.
Configuring Widget Appearance |
|
|
 |
Section 7.3.
Toplevel Windows |
|
|
 |
Section 7.4.
Dialogs |
|
|
 |
Section 7.5.
Binding Events |
|
|
 |
Section 7.6.
Message and Entry |
|
|
 |
Section 7.7.
Checkbutton, Radiobutton, and Scale |
|
|
 |
Section 7.8.
Running GUI Code Three Ways |
|
|
 |
Section 7.9.
Images |
|
|
|
 |
Chapter 8.
A Tkinter Tour, Part 2 |
|
|
 |
Section 8.1.
"On Today's Menu: Spam, Spam, and Spam" |
|
|
 |
Section 8.2.
Menus |
|
|
 |
Section 8.3.
Listboxes and Scrollbars |
|
|
 |
Section 8.4.
Text |
|
|
 |
Section 8.5.
Canvas |
|
|
 |
Section 8.6.
Grids |
|
|
 |
Section 8.7.
Time Tools, Threads, and Animation |
|
|
 |
Section 8.8.
The End of the Tour |
|
|
 |
Section 8.9.
The PyDemos and PyGadgets Launchers |
|
|
|
 |
Chapter 9.
Larger GUI Examples |
|
|
 |
Section 9.1.
"Building a Better Mouse Trap" |
|
|
 |
Section 9.2.
Advanced GUI Coding Techniques |
|
|
 |
Section 9.3.
Complete Program Examples |
|
|
 |
Section 9.4.
PyEdit: A Text Editor Program/Object |
|
|
 |
Section 9.5.
PyView: An Image and Notes Slideshow |
|
|
 |
Section 9.6.
PyDraw: Painting and Moving Graphics |
|
|
 |
Section 9.7.
PyClock: An Analog/Digital Clock Widget |
|
|
 |
Section 9.8.
PyToe: A Tic-Tac-Toe Game Widget |
|
|
 |
Section 9.9.
Where to Go from Here |
|
|
|
 |
Part III:
Internet Scripting |
|
|
 |
Chapter 10.
Network Scripting |
|
|
 |
Section 10.1.
"Tune in, Log on, and Drop out" |
|
|
 |
Section 10.2.
Plumbing the Internet |
|
|
 |
Section 10.3.
Socket Programming |
|
|
 |
Section 10.4.
Handling Multiple Clients |
|
|
 |
Section 10.5.
A Simple Python File Server |
|
|
|
 |
Chapter 11.
Client-Side Scripting |
|
|
 |
Section 11.1.
"Socket to Me!" |
|
|
 |
Section 11.2.
Transferring Files over the Net |
|
|
 |
Section 11.3.
Processing Internet Email |
|
|
 |
Section 11.4.
The PyMailGui Email Client |
|
|
 |
Section 11.5.
Other Client-Side Tools |
|
|
|
 |
Chapter 12.
Server-Side Scripting |
|
|
 |
Section 12.1.
"Oh What a Tangled Web We Weave" |
|
|
 |
Section 12.2.
What's a Server-Side CGI Script? |
|
|
 |
Section 12.3.
Climbing the CGI Learning Curve |
|
|
 |
Section 12.4.
The Hello World Selector |
|
|
 |
Section 12.5.
Coding for Maintainability |
|
|
 |
Section 12.6.
More on HTML and URL Escapes |
|
|
 |
Section 12.7.
Sending Files to Clients and Servers |
|
|
|
 |
Chapter 13.
Larger Web Site Examples I |
|
|
 |
Section 13.1.
"Things to Do When Visiting Chicago" |
|
|
 |
Section 13.2.
The PyMailCgi Web Site |
|
|
 |
Section 13.3.
The Root Page |
|
|
 |
Section 13.4.
Sending Mail by SMTP |
|
|
 |
Section 13.5.
Reading POP Email |
|
|
 |
Section 13.6.
Utility Modules |
|
|
 |
Section 13.7.
CGI Script Trade-offs |
|
|
|
 |
Chapter 14.
Larger Web Site Examples II |
|
|
 |
Section 14.1.
"Typos Happen" |
|
|
 |
Section 14.2.
The PyErrata Web Site |
|
|
 |
Section 14.3.
The Root Page |
|
|
 |
Section 14.4.
Browsing PyErrata Reports |
|
|
 |
Section 14.5.
Submitting PyErrata Reports |
|
|
 |
Section 14.6.
PyErrata Database Interfaces |
|
|
 |
Section 14.7.
Administrative Tools |
|
|
 |
Section 14.8.
Designing for Reuse and Growth |
|
|
|
 |
Chapter 15.
Advanced Internet Topics |
|
|
 |
Section 15.1.
"Surfing on the Shoulders of Giants" |
|
|
 |
Section 15.2.
Zope: A Web Publishing Framework |
|
|
 |
Section 15.3.
HTMLgen: Web Pages from Objects |
|
|
 |
Section 15.4.
JPython ( Jython): Python for Java |
|
|
 |
Section 15.5.
Grail: A Python-Based Web Browser |
|
|
 |
Section 15.6.
Python Restricted Execution Mode |
|
|
 |
Section 15.7.
XML Processing Tools |
|
|
 |
Section 15.8.
Windows Web Scripting Extensions |
|
|
 |
Section 15.9.
Python Server Pages |
|
|
 |
Section 15.10.
Rolling Your Own Servers in Python |
|
|
|
 |
Part IV:
Assorted Topics |
|
|
 |
Chapter 16.
Databases and Persistence |
|
|
 |
Section 16.1.
"Give Me an Order of Persistence, but Hold the Pickles" |
|
|
 |
Section 16.2.
Persistence Options in Python |
|
|
 |
Section 16.3.
DBM Files |
|
|
 |
Section 16.4.
Pickled Objects |
|
|
 |
Section 16.5.
Shelve Files |
|
|
 |
Section 16.6.
SQL Database Interfaces |
|
|
 |
Section 16.7.
PyForm: A Persistent Object Viewer |
|
|
|
 |
Chapter 17.
Data Structures |
|
|
 |
Section 17.1.
"Roses Are Red, Violets Are Blue; Lists Are Mutable, and So Is Class Foo" |
|
|
 |
Section 17.2.
Implementing Stacks |
|
|
 |
Section 17.3.
Implementing Sets |
|
|
 |
Section 17.4.
Binary Search Trees |
|
|
 |
Section 17.5.
Graph Searching |
|
|
 |
Section 17.6.
Reversing Sequences |
|
|
 |
Section 17.7.
Permuting Sequences |
|
|
 |
Section 17.8.
Sorting Sequences |
|
|
 |
Section 17.9.
Data Structures Versus Python Built-ins |
|
|
 |
Section 17.10.
PyTree: A Generic Tree Object Viewer |
|
|
|
 |
Chapter 18.
Text and Language |
|
|
 |
Section 18.1.
"See Jack Hack. Hack, Jack, Hack" |
|
|
 |
Section 18.2.
Strategies for Parsing Text in Python |
|
|
 |
Section 18.3.
String Module Utilities |
|
|
 |
Section 18.4.
Regular Expression Matching |
|
|
 |
Section 18.5.
Parser Generators |
|
|
 |
Section 18.6.
Hand-Coded Parsers |
|
|
 |
Section 18.7.
PyCalc: A Calculator Program/Object |
|
|
|
 |
Part V:
Integration |
|
|
 |
Chapter 19.
Extending Python |
|
|
 |
Section 19.1.
"I Am Lost at C" |
|
|
 |
Section 19.2.
C Extensions Overview |
|
|
 |
Section 19.3.
A Simple C Extension Module |
|
|
 |
Section 19.4.
The SWIG Integration Code Generator |
|
|
 |
Section 19.5.
Wrapping C Environment Calls |
|
|
 |
Section 19.6.
A C Extension Module String Stack |
|
|
 |
Section 19.7.
A C Extension Type String Stack |
|
|
 |
Section 19.8.
Wrapping C++ Classes with SWIG |
|
|
|
 |
Chapter 20.
Embedding Python |
|
|
 |
Section 20.1.
"Add Python. Mix Well. Repeat." |
|
|
 |
Section 20.2.
C Embedding API Overview |
|
|
 |
Section 20.3.
Basic Embedding Techniques |
|
|
 |
Section 20.4.
Registering Callback Handler Objects |
|
|
 |
Section 20.5.
Using Python Classes in C |
|
|
 |
Section 20.6.
ppembed: A High-Level Embedding API |
|
|
 |
Section 20.7.
Other Integration Topics |
|
|
|
 |
Part VI:
The End |
|
|
 |
Chapter 21.
Conclusion: Python and the Development Cycle |
|
|
 |
Section 21.1.
"That's the End of the Book, Now Here's the Meaning of Life" |
|
|
 |
Section 21.2.
"Something's Wrong with the Way We Program Computers" |
|
|
 |
Section 21.3.
The "Gilligan Factor" |
|
|
 |
Section 21.4.
Doing the Right Thing |
|
|
 |
Section 21.5.
Enter Python |
|
|
 |
Section 21.6.
But What About That Bottleneck? |
|
|
 |
Section 21.7.
On Sinking the Titanic |
|
|
 |
Section 21.8.
So What's Python: The Sequel |
|
|
 |
Section 21.9.
In the Final Analysis... |
|
|
 |
Section 21.10.
Postscript to the Second Edition |
|
|
|
 |
Appendix A.
Recent Python Changes |
|
|
 |
Section A.1.
Major Changes in 2.0 |
|
|
 |
Section A.2.
Major Changes in 1.6 |
|
|
 |
Section A.3.
Major Changes Between 1.3 and 1.5.2 |
|
|
|
 |
Appendix B.
Pragmatics |
|
|
 |
Section B.1.
Installing Python |
|
|
 |
Section B.2.
Book Examples Distribution |
|
|
 |
Section B.3.
Environment Configuration |
|
|
 |
Section B.4.
Running Python Programs |
|
|
 |
Section B.5.
Python Internet Resources |
|
|
|
 |
Appendix C.
Python Versus C++ |
|
|
 |
Colophon |
|
 |
Index |