Book web site: http://www.pauahtun.org/TYPython/
Van Laningham, Ivan
Date finished: 2002-01-01
The mere title of the SAMS "Teach Yourself X in 24 Hours" series raises people's hackles at the presumptuous idea of learning a significant new tool or skill in a single day's effort. (See Peter Norvig's counterblast "Learn Programming in 21 Days? Or 10 Years?" for a stately example of the usual reaction.) The "24 Hours" of the titles is a bit deceptive, though, actually meaning that the books are broken into 24 chapters, each a one-hour lesson, that could be read over several days. Completing them all within a single calendar day, however, isn't really possible, despite the title implying that.
I've previously read another book in this series, "Teach Yourself GIMP in 24 Hours", and found it quite useful in getting a broad overview of the GIMP's features. "Teach Yourself Python" is similar, providing an overview of Python that's fairly broad, not very rigorous or deep, and doesn't attempt to be a reference. Van Laningham's writing style is conversational and fluid, with entertaining digressions into side topics such as computing history or calendrical computations. One of the delights in this book is the "Exercises" section at the end of each chapter, containing open-ended suggestions for future projects and links to related Web pages. Van Laningham is clearly aware that programming skill has a slippery definition and is gained as a craft rather than a science, and tries to impress these points upon the reader, something rare in introductory texts. I'd love to see this writing style applied to broader topics of programming technique and structuring, rather than the fiddly details of syntax and data types; it would produce something similar to Richard P. Gabriel's Patterns of Software or The Pragmatic Programmer by Hunt/Thomas.
The first 8 chapters of the book go over the well-trodden ground of Python basics: the basic data types such as numbers, strings, lists, and dictionaries; operators and variable assignment; flow control statements; functions and modules. This section is solid and straightforward.
I'm not sure chapters 9 through 13 on object-oriented programming would be at all clear to a beginning programmer. It's difficult for me to judge this, of course, and certainly when reviewing an introductory book experienced programmers tend to attribute supernatural feebleness to the intended audience and to underestimate their ability. Still, it seems to me that the OOP chapters get pretty murky at times. While the text is technically accurate, at times I had to read and parse sentences very carefully to compare my understanding of Python semantics with the book's explanation, and a beginning programmer would find it difficult to follow the text, especially given that there are no helpful diagrams. In particular the explanation of namespaces seems dense and confusing. Finally, the now and today classes used for examples throughout these chapter are small toy classes, meaning there's no particular motivation for making one class inherit from the other. A more realistic example would have been better.
Chapters 14 and 15 are quite good, following a simple file-munging script from initial conception to development through to documentation and modularization. While these chapters are the tail end of the second part of the book, covering OO, the script doesn't use OOP at all, and these chapters could have come earlier in the book and been included in Part I. This would have been be a better organization, since these two chapters are very good demonstrations of modifying a program and of the importance of proper style, and show a small but realistic motivating example.
The final eight chapters contain a brief introduction to Tkinter that's reasonably good, though of course it's not possible to cover Tkinter programming, or even every Tk widget, in 150 pages. It probably provides enough information to learn more about Tkinter using other resources.
My major gripe about the book, besides my concerns about the clarity of the OO chapters, is its sloppy production; typos and formatting errors are frequent, sometimes including misindented Python code in the program listings. Interpreter interactions and the output of Python code are shown using screen grabs of a Windows DOS shell, resulting in tiny characters that are low-contrast and very difficult to read, and wastes much space when the output is just a few lines.
To sum up: An introductory book on Python that's reasonably good on the basics, though I'm doubtful whether beginners will find the book's explanation of object-oriented programming to be readily understandable. The author's personality is entertainingly apparent throughout, something sadly all too rare in computer books. Unfortunately the book's production is poor, with hard-to-read screenshots and many typos, meaning it just barely earns its ranking of 3 coils out of five: not a bad introduction, but definitely flawed.
%T Teach Yourself Python in 24 Hours %A Van Laningham, Ivan %I SAMS %P 484pp %G ISBN 0-672-31735-4 %@ 2002-01-01 %K Python, programming languages %U http://www.pauahtun.org/TYPython/ %W http://www.pauahtun.org/