Dive Into Python

Front Cover
Apress, Jul 12, 2004 - Computers - 432 pages

Whether you're an experienced programmer looking to get into Python or grizzled Python veteran who remembers the days when you had to import the string module, Dive Into Python is your 'desert island' Python book.

— Joey deVilla, Slashdot contributor

As a complete newbie to the language...I constantly had those little thoughts like, 'this is the way a programming language should be taught.'

— Lasse Koskela , JavaRanch

Apress has been profuse in both its quantity and quality of releasesand (this book is) surely worth adding to your technical reading budget for skills development.

— Blane Warrene, Technology Notes

I am reading this ... because the language seems like a good way to accomplish programming tasks that don't require the low-level bit handling power of C.

— Richard Bejtlich, TaoSecurity

Python is a new and innovative scripting language. It is set to replace Perl as the programming language of choice for shell scripters, and for serious application developers who want a feature-rich, yet simple language to deploy their products.

Dive Into Python is a hands-on guide to the Python language. Each chapter starts with a real, complete code sample, proceeds to pick it apart and explain the pieces, and then puts it all back together in a summary at the end.

This is the perfect resource for you if you like to jump into languages fast and get going right away. If you're just starting to learn Python, first pick up a copy of Magnus Lie Hetland's Practical Python.

 

Contents

Introduction χν Chapter 1 Installing Python
1
Python on Mac OS
3
The Interactive Shell
10
Your First Python Program
11
Indenting Code
18
Native Datatypes
23
Mapping Lists
41
The Power of Introspection
49
SOAP Web Services
249
Troubleshooting SOAP Web Services
265
Unit Testing
271
Summary
285
TestFirst Programming
287
Converting Roman Numerals Stage 4
301
Refactoring
309
Refactoring for Performance
321

Using lambda Functions
64
Objects and ObjectOrientation
71
Instantiating Classes
80
Using Private Functions
93
Exceptions and File Handling
97
Using sys modules
109
Regular Expressions
121
Roman Numerals
124
Summary
139
HTML Processing
141
Understanding locals and globals
157
Summary
170
XML Processing
171
Dealing with Unicode
185
Scripts and Streams
197
Using Standard Input Output and Error
202
Putting It All Together
217
HTTP Web Services
221
Handling LastModified and ETag
232
Summary
247
Functional Programming
331
Mapping Lists Revisited
338
Summary
347
Dynamic Functions
349
Pluralizing Nouns Stage 3
355
Pluralizing Nouns Stage 6
361
Performance Tuning
367
Using the timeit Module
370
Optimizing Dictionary Lookups
376
Optimizing String Manipulation
383
Appendix A Python License
387
Appendix B GNU Free Documentation License
393
Verbatim Copying
395
Modifications
396
Combining Documents
398
Translation
399
How to Use This License for Your Documents
400
Index
401
Copyright

Other editions - View all

Common terms and phrases

About the author (2004)

By day, Mark Pilgrim is a developer advocate for open source and open standards. By night, he is a husband and father who lives in North Carolina with his wife, his two sons, and his big slobbery dog. He spends his copious free time sunbathing, skydiving, and making up autobiographical information.