Learning Python : Help for Programmers

Publisher : O'Reilly & Associates

ISBN: 1565924649

Programming Python (2nd Edition)

Publisher : O'Reilly & Associates

ISBN: 0596000855

Python Standard Library

Publisher : O'Reilly & Associates

ISBN: 0596000960

Learning Python : Help for Programmers

"Learning Python" (LP) is divided into two sections, "The Core Language" (chapters 1-7) and "The Outer Layers" (chapters 8-10). The chapters in the Core Language portion of the book deal with data types, statements (this is the chapter where the reader gets their first explicit introduction to Python syntax), functions, modules (modules being code snippets saved as .py files that can be imported and used in other scripts), classes (this is the OOP chapter), and exceptions. Built-in functions, the standard library (the set of modules that come bundled in the python distributions that you can download from python.org), and some examples of how to approach some common tasks using Python are addressed briefly in the 3 "Outer Layers" chapters, 2 of which are available online. The three appendices cover Python resources (Python.org/PSA, some 3rd party tools, where to find the documentation at Python.org, Python newsgroups, etc), give an aerial view of platform-specific extensions and ports, and furnish the solutions to the exercises assigned at the end of each chapter.

LP is everything that I've come to expect from an O'Reilly book - lucid, detailed, and well-written. Anyone concerned that a book published in mid-1999 might be a bit out of date (the current Python release at the time was v.1.5.2 and 2.0.1, a bug-squashed version of 2.0, is out now), should look over "What's New in Python 2.0" at Python.org. Aside from the addition of augmented assignment operators (like +=) and list comprehensions, none of the changes affected the heart of the language; the few modules depreciated with the landing of v2.0 weren't used at all in the "Outer Layers" portion of the text. The book is still current.

Lutz and Ascher do a great job of walking beginners through the language. Too often, the "Common Mistakes" sections in programming books amount to nothing more than weak chapter summaries, but this isn't the case with the "Gotchas" section at the end of each chapter in LP. Taken together, they're probably my favorite aspect of the book, second only to the chapter on classes, which did more to help me wrap my head around object-oriented programming than all of the chapters on "how to try to simulate OOP in a language to which some OOP functionality was tacked on as an afterthought" to which I've subjected myself over the past few years combined. After all, one of Python's biggest draws inasfar as attracting developers (and definitely the reason that I spent a weekend camped out with a stack of Python books) is the fact that the language was designed from the ground up with OOP in mind.

To be honest, I can't really think of anything that bugged me about LP, although the comparisons between how X is done in Python as opposed to how it would be done in C that appear here and there throughout the book would have been more meaningful to me if I had some background in C. While it did not at all detract from my enjoyment of the book, I'm also not sure that the discussion of Python's syntax rules was best situated inside the section on if tests. The material doesn't show up in the table of contents at all, which could be a pain for someone specifically looking for coverage of Python's unusual syntax (indentation and end-of-line's take the places occupied by curly braces and semicolons in other languages) if they don't think to check the index. Yes, these are very minor points and yes, I love the book.

Programming Python (2nd Edition)

Lutz's "Programming Python" (2nd ed.), published in March, is intended for those who've got a handle on the basics of the language (the ground covered in LP) and are ready to tackle some applications. Weighing in at more than 1,200 pages, this is not the sort of book that's meant to be read from cover to cover in one sitting — it's more the kind of text that you'll digest in bite-sized portions. The author touches on such a wide variety of projects that you're practically guaranteed to find something relevant to what you want to work on at any given time (the PyErrata web site case study in the 2nd "Larger Web Site Examples" chapter is of special interest to me at the moment), but precisely because there's so much meat in this book, it strikes me as the type of resource that you'll grow into as you mature in the language. Each chapter covers a specific Python programming topic in depth, and related chapters are grouped together - the portion of the book devoted to "Internet Scripting", for example, embraces 6 chapters, the last of which, "Advanced Internet Topics", you can check out online. In addition to a copy of the Python documentation, the accompanying CD includes the Python 2.0 source distribution along with packages for Mac and Windows and the Linux RPM.

Python Standard Library

From the preface : "After posting a couple of scripts each week, for a number of years, you end up with a rather large collection of potentially useful scripts.". Fredrik Lundh delivers the code - "Python Standard Library" (May 2001) contains 360 Python scripts - at least one for each of the 200 modules in the Python Standard Library (with the exception of the Tkinter gui library, which isn't covered). The description of each module that preceeds the script(s) is very brief, so if you want more information on a given module, check out the docs on the Programming Python CD (the cd included with "Python Standard Library" contains all of the scripts from the book itself) or point your browser at the Python.org Python Library Reference. The online sample chapter "File Formats" is representative of the rest of the text.