Synopses & Reviews
Programming Python is a classic O'Reilly Nutshell Handbook® describing the use of the Python programming/scripting language. Python is a popular scripting language freely available over the Net. Like Perl, Python is powerful, but easier to use than a traditional compiler language like C or C++. Although it is used mostly in UNIX environments (including Linux), it is available on Windows and Mac platforms as well. Unlike Perl, Python uses an object-oriented paradigm, making it a particularly useful scripting language for C++ programmers and the Windows/OLE and Mac environments. This book will serve the Python community as our Programming Perl book does for the Perl community.This book complements the online reference material provided with the Python releases. It is endorsed by the creator of Python, Guido van Rossum, who wrote the foreword. The CD-ROM included with the book contains Python 1.3 binaries for most popular UNIX platforms, as well as Linux, Windows, NT, and the Mac. This book is the most comprehensive Python user material available from any publisher. It contains a number of running examples, presented simply at first but becoming more complex as new issues appear. Examples describing Graphical User Interface (GUI) programming use the Tk language. (Tk is usually considered a part of the Tcl scripting language, but is in fact usable with other scripting languages like Perl and Python.)An appendix contains a separate short language tutorial.
This book describes how to use Python, an increasingly popularobject-oriented scripting language freely available over the Net.Python is an interpreted language, useful for quick prototyping andsimple programs for which C++ is too complex and unwieldy.The Pythoninterpreter is available on most popular UNIX platforms, including Linux, as well as Windows, NT, and the Mac."Programming Python, the most comprehensive source of user material availablefor this scripting language, complements online reference material providedwith Python releases.It has been both reviewed and endorsed by Pythoncreator Guido van Rossum, who also provides the foreword.You'll findmany useful running examples, which become more complex as new topicsare introduced.Examples that describe Graphical User Interface (GUI)use TK as well as Python.An appendix contains a short language tutorial.Includes a CD-ROM containing Python software for all major UNIX platforms, as well as Windows, NT, and the Mac. This authoritative guide offers the Python community what our "ProgrammingPerl book offers the Perl community.
This handbook describes how to use Python, an increasingly popular object-oriented scripting language freely available over the Net. Python is an interpreted language, useful for quick prototyping and simple programs for which C++ is too complex and unwieldy. The Python interpreter is available on most popular UNIX platforms, including Linux, as well as Windows and the Mac.
Includes bibliographical references (p. 858-860) and index.
About the Author
Mark Lutz is the world leader in Python training, the author of Python's earliest and best-selling texts, and a pioneering figure in the Python community since 1992. He has been a software developer for 25 years, and is the author of O'Reilly's Programming Python, 3rd Edition and Python Pocket Reference, 3rd Edition.
Table of Contents
Table of Contents
PART 1: Introducing Python
Chapter 1. So What's Python?
"And Now for Something Completely Different"
The Life of Python
What's All the Excitement About?
The Compulsory Features List
What's Python Good For?
What's Python Not Good For?
Chapter 2. A Sneak Preview
"Put Your Code Where Your Mouth Is"
Shell Tools Programming
Graphical User Interfaces
Data Structure Libraries
Processing Text-Based Information
Extension Language Programming
And Whatever Else You Want to Use It For
Chapter 3. Getting Started
"Scenes from Life in the Real World"
Configuring Your Environment
And If All Else Fails
Using the Command-Line Interpreter
Using the Python Command Line
Platforms Supported Today
PART 2: Language Fundamentals
Chapter 4. Writing Basic Shell Tools
It Was a Dark and Stormy Night...
"Quick and Dirty" File Packing
Dissecting the Code
New Language Concepts
"Telling the Monkeys What to Do"
Chapter 5. Variations on a Theme
"How Shall I Code Thee? Let Me Count the Ways"
Packing With File Methods
Packing with Explicit Files
Packing with Counter Loops
Unpacking with Explicit Files
Unpacking with Line-by-Line Input
Unpacking Without File Methods
Crunching the Code (to Death)
Chapter 6. Adding a Functional Interface
"The Packing Scripts Go Public"
Part 1: "The Middleman"
Part 2: "The Unpacker on Steroids"
Part 3: "The Packer Hits the Big Time"
Building Systems with Functions
Chapter 7. Adding a Simple User Interface
"Go Ahead--Reuse My Software"
Running Scripts Versus Calling Functions
Running the Interface in batch Mode
Building Systems with Modules
Chapter 8. Adding Text-Based Menus
"On Today's Menu: Packing, Unpacking, and Fresh Spam"
Making Menus with Dictionaries
Making Menus with Lists
Built-In Types: Operators, Methods, and Modules
The Zen of Python: Namespaces are Dictionaries
Dictionaries and Keyword Arguments
Design Concepts: Do Modules Support OOP?
Chapter 9. Moving Menus to Classes
"Here's Your Script. Here's Your Script on OOP. Any Questions?"
A First Attempt: Generalized Menu Functions
So Who Needs Classes?
OOP in Action: Menus as Classes
Exploring Python Classes
Configuring Menu Data
Namespaces, Part 3: Classes and Instances
More on Zen: Class and Instance Namespace Dictionaries
Design Concepts: Implementing Generic Functions
Chapter 10. More Class Magic
More Bells, Whistles, and Little Blinking Lights
Deriving Menus from Simpler User Interaction
A Simple User-Interface Subclass: Back to Where We Started?
A Menu-Interface Subclass: Registering Methods
Inheriting from More than One Class
More on Exception Handling: Exception Lists
Making Menus Expandable: Overloading Operators
Summary: Python and the OOP Trinity
Design Exercise: Adding Logging and Security Extensions
Where's the Beef?
Welcome to the Middle of the Book!
A Quick Summary of Topics We've Covered So Far
Plus a Few Shell Tool Tricks
Python in a Nutshell
Brewing Python tee
PART 3: Tools and Applications
Chapter 11. Graphical User Interfaces
"Here's Looking at You, Kid"
Climbing the GUI Learning Curve
Automating GUI Construction
Case Study: "The Packer Goes GUI!"
Avoiding Namespace Clashes
Handling Program Errors
A Totally RAD Language
Other Tkinter Topics
Chapter 12. Persistent Information
"Give Me an Order of Persistence, But Hold the Pickles"
Case Study: a Table Browser GUI
Other Persistence Topics
Chapter 13. Implementing Objects
"Roses are Red, Violets are Blue; Lists are Mutable, and So is Class Foo"
Classical Data Structures in Python
Chapter 14. Extending Python
"I Am Lost at C"
Examples We've Already Seen
Moving Stacks to a C Extension Module
Moving Stacks to a C Extension Type
Now, Forget Most of the Details
Chapter 15. Embedding Python
"Add Python. Mix well. Repeat."
Python's Embedded Call API
Basic Embedding Strategies
A Higher-Level Embedded Call API
An Embedded Call API Client
Case Study: Embedding User-Coded Validations
Other Approaches: Registering Callable Objects
Other Integration Topics
Automated Integration Techniques
Summary: Python/C Integration Techniques
Chapter 16. Processing Language and Text
"See Jack Hack. Hack, Jack, Hack"
Strategies for Parsing Text in Python
Case Study: A Calculator GUI
The "Big Finish": A Real Calculator GUI
Conclusion: Python and the Development Cycle" 697
"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
But What About That Bottleneck?
On Sinking the Titanic
So What's Python: the Sequel
In the Final Analysis...
"Roll the Closing Credits"
PART 4: Appendixes
Appendix A. ...And Other Cool Stuff
Appendix B. Futurisms
Appendix C. A Mini-Reference
Appendix D. An Application Framework
Appendix E. A Python Tutorial
Appendix F. Python Classes for C++ Programmers