Programming Python
Mark Lutz(Author)
O'Reilly (Publisher)
3rd Edition
Published on 26. September 2006
Book
Paperback/Softback
1596 pages
978-0-596-00925-0 (ISBN)
Article exhausted; check for reprint
Description
Already the industry standard for Python users, Programming
Python from
O'Reilly just got even better. This third edition has been updated to
reflect current best practices and
the abundance of changes introduced by the latest version of the
language, Python 2.5.
Whether you're a novice or an advanced
practitioner, you'll find this
refreshed book more than lives up to its reputation. Programming
Python, 3rd Edition, teaches you the right
way to code. It explains Python language syntax and programming
techniques in a clear and concise
manner, with numerous examples that illustrate both correct usage and
common idioms. By reading this
comprehensive guide, you'll learn how to apply Python in real-world
problem domains such as:
* GUI programming
* Internet scripting
* Parallel processing
* Database management
* Networked applications
Programming Python, Third Edition covers
each of these
target domains
gradually, beginning with in-depth discussions of core concepts and
then progressing toward complete
programs. Large examples do appear, but only after you've learned
enough to understand their techniques and
code.
Along the way, you'll also learn how to use the Python language in
realistically scaled programs--concepts such as Object-Oriented Programming (OOP) and code reuse
are recurring side themes throughout this
text. If you're interested in Python programming, then this O'Reilly
classic needs to be within arm's reach. The
wealth of practical advice, snippets of code, and patterns of program
design can all be put into use on a
daily basis--making your life easier and more productive.
Reviews of the second edition:
".about as comprehensive as any book can be."
--Dr. Dobb's Journal
"If the language had manuals, they would undoubtedly
be the texts from O'Reilly.'Learning Python' and 'Programming Python'
are definitive treatments."
--SD Times
Python from
O'Reilly just got even better. This third edition has been updated to
reflect current best practices and
the abundance of changes introduced by the latest version of the
language, Python 2.5.
Whether you're a novice or an advanced
practitioner, you'll find this
refreshed book more than lives up to its reputation. Programming
Python, 3rd Edition, teaches you the right
way to code. It explains Python language syntax and programming
techniques in a clear and concise
manner, with numerous examples that illustrate both correct usage and
common idioms. By reading this
comprehensive guide, you'll learn how to apply Python in real-world
problem domains such as:
* GUI programming
* Internet scripting
* Parallel processing
* Database management
* Networked applications
Programming Python, Third Edition covers
each of these
target domains
gradually, beginning with in-depth discussions of core concepts and
then progressing toward complete
programs. Large examples do appear, but only after you've learned
enough to understand their techniques and
code.
Along the way, you'll also learn how to use the Python language in
realistically scaled programs--concepts such as Object-Oriented Programming (OOP) and code reuse
are recurring side themes throughout this
text. If you're interested in Python programming, then this O'Reilly
classic needs to be within arm's reach. The
wealth of practical advice, snippets of code, and patterns of program
design can all be put into use on a
daily basis--making your life easier and more productive.
Reviews of the second edition:
".about as comprehensive as any book can be."
--Dr. Dobb's Journal
"If the language had manuals, they would undoubtedly
be the texts from O'Reilly.'Learning Python' and 'Programming Python'
are definitive treatments."
--SD Times
Reviews / Votes
"It's the industry standard publication on Python, but don't be put off if you're a beginner. It takes a lot of shelf space, but it's worth it!" .NET, February 2007More details
Language
English
Place of publication
Sebastopol
United States
Target group
Professional and scholarly
Edition type
Revised edition
Illustrations
Illustrations
Dimensions
Height: 234 mm
Width: 186 mm
Weight
1988 gr
ISBN-13
978-0-596-00925-0 (9780596009250)
Schweitzer Classification
Other editions
New editions

Additional editions


Previous edition

Mark Lutz
Programming Python
Book
04/2001
2nd Edition
O'Reilly
€49.00
Article exhausted; check for reprint
Person
Mark Lutz is an independent Python trainer, writer, and software developer, and is one of the pioneering figures in the Python community. He is the author of the O'Reilly books Programming Python and Python Pocket Reference, and co-author of Learning Python (all in 2nd or 3rd Editions). Mark has been involved with Python since 1992, began teaching Python classes in 1997, and has instructed over 125 Python training sessions as of early 2005. In addition, he holds BS and MS degrees in computer science from the University of Wisconsin, and over the last two decades has worked on compilers, programming tools, scripting applications, and assorted client/server systems. Whenever Mark gets a break from spreading the Python word, he leads an ordinary, average life in Colorado. Mark can be reached on the web at http://www.rmi.net/~lutz.
Content
Inhaltsverzeichnis
Foreword
Preface
Part I. The Beginning
1. Introducing Python
"And Now for Something Completely Different"
Python Philosophy 101
The Life of Python
Signs of the Python Times
The Compulsory Features List
What's Python Good For?
What's Python Not Good For?
Truth in Advertising
2. A Sneak Preview
"Programming Python: The Short Story"
The Task
Step 1: Representing Records
Step 2: Storing Records Persistently
Step 3: Stepping Up to OOP
Step 4: Adding Console Interaction
Step 5: Adding a GUI
Step 6: Adding a Web Interface
The End of the Demo
Part II. System Programming
3. System Tools
"The os.path to Knowledge"
System Scripting Overview
Introducing the sys Module
Introducing the os Module
Script Execution Context
Current Working Directory
Command-Line Arguments
Shell Environment Variables
Standard Streams
4. File and Directory Tools
"Erase Your Hard Drive in Five Easy Steps!"
File Tools
Directory Tools
5. Parallel System Tools
"Telling the Monkeys What to Do"
Forking Processes
Threads
Program Exits
Interprocess Communication
Pipes
Signals
Other Ways to Start Programs
A Portable Program-Launch Framework
Other System Tools
6. System Examples: Utilities
"Splits and Joins and Alien Invasions"
Splitting and Joining Files
Generating Forward-Link Web Pages
A Regression Test Script
Packing and Unpacking Files
Automated Program Launchers
7. System Examples: Directories
"The Greps of Wrath"
Fixing DOS Line Ends
Fixing DOS Filenames
Searching Directory Trees
Visitor: Walking Trees Generically
Copying Directory Trees
Deleting Directory Trees
Comparing Directory Trees
Part III. GUI Programming
8. Graphical User Interfaces
"Here's Looking at You, Kid"
Python GUI Development Options
Tkinter Overview
Climbing the GUI Learning Curve
Tkinter Coding Basics
Tkinter Coding Alternatives
Adding Buttons and Callbacks
Adding User-Defined Callback Handlers
Adding Multiple Widgets
Customizing Widgets with Classes
Reusable GUI Components with Classes
The End of the Tutorial
Python/Tkinter for Tcl/Tk Converts
9. A Tkinter Tour, Part 1
"Widgets and Gadgets and GUIs, Oh My!"
Configuring Widget Appearance
Top-Level Windows
Dialogs
Binding Events
Message and Entry
Checkbutton, Radiobutton, and Scale
Running GUI Code Three Ways
Images
Viewing and Processing Images with PIL
10. A Tkinter Tour, Part 2
"On Today's Menu: Spam, Spam, and Spam"
Menus
Listboxes and Scrollbars
Text
Canvas
Grids
Time Tools, Threads, and Animation
The End of the Tour
The PyDemos and PyGadgets Launchers
11. GUI Coding Techniques
"Building a Better Mouse Trap"
GuiMixin: Common Tool Mixin Classes
GuiMaker: Automating Menus and Toolbars
ShellGui: GUIs for Command-Line Tools
GuiStreams: Redirecting Streams to Widgets
Reloading Callback Handlers Dynamically
Wrapping Up Top-Level Window Interfaces
GUIs, Threads, and Queues
More Ways to Add GUIs to Non-GUI Code
12. Complete GUI Programs
"Python, Open Source, and Camaros"
PyEdit: A Text Editor Program/Object
PyPhoto: An Image Viewer and Resizer
PyView: An Image and Notes Slideshow
PyDraw: Painting and Moving Graphics
PyClock: An Analog/Digital Clock Widget
PyToe: A Tic-Tac-Toe Game Widget
Where to Go from Here
Part IV. Internet Programming
13. Network Scripting
"Tune In, Log On, and Drop Out"
Plumbing the Internet
Socket Programming
Handling Multiple Clients
A Simple Python File Server
14. Client-Side Scripting
"Socket to Me!"
FTP: Transferring Files over the Net
Processing Internet Email
POP: Fetching Email
SMTP: Sending Email
email: Parsing and Composing Mails
pymail: A Console-Based Email Client
The mailtools Utility Package
NNTP: Accessing Newsgroups
HTTP: Accessing Web Sites
Module urllib Revisited
Other Client-Side Scripting Options
15. The PyMailGUI Client
"Use the Source, Luke"
A PyMailGUI Demo
PyMailGUI Implementation
16. Server-Side Scripting
"Oh What a Tangled Web We Weave"
What's a Server-Side CGI Script?
Running Server-Side Examples
Climbing the CGI Learning Curve
Saving State Information in CGI Scripts
The Hello World Selector
Refactoring Code for Maintainability
More on HTML and URL Escapes
Transferring Files to Clients and Servers
17. The PyMailCGI Server
"Things to Do When Visiting Chicago"
The PyMailCGI Web Site
The Root Page
Sending Mail by SMTP
Reading POP Email
Processing Fetched Mail
Utility Modules
CGI Script Trade-Offs
18. Advanced Internet Topics
"Surfing on the Shoulders of Giants"
Zope: A Web Application Framework
HTMLgen: Web Pages from Objects
Jython: Python for Java
Grail: A Python-Based Web Browser
XML Processing Tools
Windows Web Scripting Extensions
Python Server Pages
Rolling Your Own Servers in Python
And Other Cool Stuff
Part V. Tools and Techniques
19. Databases and Persistence
"Give Me an Order of Persistence, but Hold the Pickles"
Persistence Options in Python
DBM Files
Pickled Objects
Shelve Files
The ZODB Object-Oriented Database
SQL Database Interfaces
PyForm: A Persistent Object Viewer
20. Data Structures
"Roses Are Red, Violets Are Blue; Lists Are Mutable, and So Is Set Foo"
Implementing Stacks
Implementing Sets
Subclassing Built-In Types
Binary Search Trees
Graph Searching
Reversing Sequences
Permuting Sequences
Sorting Sequences
Data Structures Versus Python Built-Ins
PyTree: A Generic Tree Object Viewer
21. Text and Language
"See Jack Hack. Hack, Jack, Hack"
Strategies for Parsing Text in Python
String Method Utilities
Regular Expression Pattern Matching
Advanced Language Tools
Handcoded Parsers
PyCalc: A Calculator Program/Object
Part VI. Integration
22. Extending Python
"I Am Lost at C"
Integration Modes
C Extensions Overview
A Simple C Extension Module
Extension Module Details
The SWIG Integration Code Generator
Wrapping C Environment Calls
A C Extension Module String Stack
A C Extension Type String Stack
Wrapping C++ Classes with SWIG
Other Extending Tools
23. Embedding Python
"Add Python. Mix Well. Repeat."
C Embedding API Overview
Basic Embedding Techniques
Registering Callback Handler Objects
Using Python Classes in C
A High-Level Embedding API: ppembed
Other Integration Topics
Part VII. The End
24. Conclusion: Python and the Development Cycle
"That's the End of the Book, Now Here's the Meaning of Life"
"Something's Wrong with the Way We Program Computers"
The "Gilligan Factor"
Doing the Right Thing
Enter Python
But What About That Bottleneck?
On Sinking the Titanic
So What's "Python: The Sequel"?
In the Final Analysis.
Postscript to the Second Edition (2000)
Postscript to the Third Edition (2006)
Index
Foreword
Preface
Part I. The Beginning
1. Introducing Python
"And Now for Something Completely Different"
Python Philosophy 101
The Life of Python
Signs of the Python Times
The Compulsory Features List
What's Python Good For?
What's Python Not Good For?
Truth in Advertising
2. A Sneak Preview
"Programming Python: The Short Story"
The Task
Step 1: Representing Records
Step 2: Storing Records Persistently
Step 3: Stepping Up to OOP
Step 4: Adding Console Interaction
Step 5: Adding a GUI
Step 6: Adding a Web Interface
The End of the Demo
Part II. System Programming
3. System Tools
"The os.path to Knowledge"
System Scripting Overview
Introducing the sys Module
Introducing the os Module
Script Execution Context
Current Working Directory
Command-Line Arguments
Shell Environment Variables
Standard Streams
4. File and Directory Tools
"Erase Your Hard Drive in Five Easy Steps!"
File Tools
Directory Tools
5. Parallel System Tools
"Telling the Monkeys What to Do"
Forking Processes
Threads
Program Exits
Interprocess Communication
Pipes
Signals
Other Ways to Start Programs
A Portable Program-Launch Framework
Other System Tools
6. System Examples: Utilities
"Splits and Joins and Alien Invasions"
Splitting and Joining Files
Generating Forward-Link Web Pages
A Regression Test Script
Packing and Unpacking Files
Automated Program Launchers
7. System Examples: Directories
"The Greps of Wrath"
Fixing DOS Line Ends
Fixing DOS Filenames
Searching Directory Trees
Visitor: Walking Trees Generically
Copying Directory Trees
Deleting Directory Trees
Comparing Directory Trees
Part III. GUI Programming
8. Graphical User Interfaces
"Here's Looking at You, Kid"
Python GUI Development Options
Tkinter Overview
Climbing the GUI Learning Curve
Tkinter Coding Basics
Tkinter Coding Alternatives
Adding Buttons and Callbacks
Adding User-Defined Callback Handlers
Adding Multiple Widgets
Customizing Widgets with Classes
Reusable GUI Components with Classes
The End of the Tutorial
Python/Tkinter for Tcl/Tk Converts
9. A Tkinter Tour, Part 1
"Widgets and Gadgets and GUIs, Oh My!"
Configuring Widget Appearance
Top-Level Windows
Dialogs
Binding Events
Message and Entry
Checkbutton, Radiobutton, and Scale
Running GUI Code Three Ways
Images
Viewing and Processing Images with PIL
10. A Tkinter Tour, Part 2
"On Today's Menu: Spam, Spam, and Spam"
Menus
Listboxes and Scrollbars
Text
Canvas
Grids
Time Tools, Threads, and Animation
The End of the Tour
The PyDemos and PyGadgets Launchers
11. GUI Coding Techniques
"Building a Better Mouse Trap"
GuiMixin: Common Tool Mixin Classes
GuiMaker: Automating Menus and Toolbars
ShellGui: GUIs for Command-Line Tools
GuiStreams: Redirecting Streams to Widgets
Reloading Callback Handlers Dynamically
Wrapping Up Top-Level Window Interfaces
GUIs, Threads, and Queues
More Ways to Add GUIs to Non-GUI Code
12. Complete GUI Programs
"Python, Open Source, and Camaros"
PyEdit: A Text Editor Program/Object
PyPhoto: An Image Viewer and Resizer
PyView: An Image and Notes Slideshow
PyDraw: Painting and Moving Graphics
PyClock: An Analog/Digital Clock Widget
PyToe: A Tic-Tac-Toe Game Widget
Where to Go from Here
Part IV. Internet Programming
13. Network Scripting
"Tune In, Log On, and Drop Out"
Plumbing the Internet
Socket Programming
Handling Multiple Clients
A Simple Python File Server
14. Client-Side Scripting
"Socket to Me!"
FTP: Transferring Files over the Net
Processing Internet Email
POP: Fetching Email
SMTP: Sending Email
email: Parsing and Composing Mails
pymail: A Console-Based Email Client
The mailtools Utility Package
NNTP: Accessing Newsgroups
HTTP: Accessing Web Sites
Module urllib Revisited
Other Client-Side Scripting Options
15. The PyMailGUI Client
"Use the Source, Luke"
A PyMailGUI Demo
PyMailGUI Implementation
16. Server-Side Scripting
"Oh What a Tangled Web We Weave"
What's a Server-Side CGI Script?
Running Server-Side Examples
Climbing the CGI Learning Curve
Saving State Information in CGI Scripts
The Hello World Selector
Refactoring Code for Maintainability
More on HTML and URL Escapes
Transferring Files to Clients and Servers
17. The PyMailCGI Server
"Things to Do When Visiting Chicago"
The PyMailCGI Web Site
The Root Page
Sending Mail by SMTP
Reading POP Email
Processing Fetched Mail
Utility Modules
CGI Script Trade-Offs
18. Advanced Internet Topics
"Surfing on the Shoulders of Giants"
Zope: A Web Application Framework
HTMLgen: Web Pages from Objects
Jython: Python for Java
Grail: A Python-Based Web Browser
XML Processing Tools
Windows Web Scripting Extensions
Python Server Pages
Rolling Your Own Servers in Python
And Other Cool Stuff
Part V. Tools and Techniques
19. Databases and Persistence
"Give Me an Order of Persistence, but Hold the Pickles"
Persistence Options in Python
DBM Files
Pickled Objects
Shelve Files
The ZODB Object-Oriented Database
SQL Database Interfaces
PyForm: A Persistent Object Viewer
20. Data Structures
"Roses Are Red, Violets Are Blue; Lists Are Mutable, and So Is Set Foo"
Implementing Stacks
Implementing Sets
Subclassing Built-In Types
Binary Search Trees
Graph Searching
Reversing Sequences
Permuting Sequences
Sorting Sequences
Data Structures Versus Python Built-Ins
PyTree: A Generic Tree Object Viewer
21. Text and Language
"See Jack Hack. Hack, Jack, Hack"
Strategies for Parsing Text in Python
String Method Utilities
Regular Expression Pattern Matching
Advanced Language Tools
Handcoded Parsers
PyCalc: A Calculator Program/Object
Part VI. Integration
22. Extending Python
"I Am Lost at C"
Integration Modes
C Extensions Overview
A Simple C Extension Module
Extension Module Details
The SWIG Integration Code Generator
Wrapping C Environment Calls
A C Extension Module String Stack
A C Extension Type String Stack
Wrapping C++ Classes with SWIG
Other Extending Tools
23. Embedding Python
"Add Python. Mix Well. Repeat."
C Embedding API Overview
Basic Embedding Techniques
Registering Callback Handler Objects
Using Python Classes in C
A High-Level Embedding API: ppembed
Other Integration Topics
Part VII. The End
24. Conclusion: Python and the Development Cycle
"That's the End of the Book, Now Here's the Meaning of Life"
"Something's Wrong with the Way We Program Computers"
The "Gilligan Factor"
Doing the Right Thing
Enter Python
But What About That Bottleneck?
On Sinking the Titanic
So What's "Python: The Sequel"?
In the Final Analysis.
Postscript to the Second Edition (2000)
Postscript to the Third Edition (2006)
Index