Core Python Programming

May 1st, 2001 by Michael Baxter in

Finally, a book good enough to be both a textbook and a reference on the Python language now exists.
  • Author: Wesley J. Chun

  • Publisher: Prentice Hall PTR

  • URL: http://www.phptr.com/

  • Price: $44.99 US

  • ISBN: 0-13-026036-3

  • Reviewer: Michael Baxter

Finally, a book good enough to be both a textbook and a reference on the Python language now exists. Part of Prentice Hall's PTR Core Series, this book works well as a first Python textbook for computer science students, while also being thumbable for work-a-day use by Python programmers.

The book divides Python into two main parts. In Part I, about 500 pages explain the rudiments of Python: how to program in Python, the syntax, data types and key language features, all cleanly divided into 14 chapters. Each chapter is compartmentalized yet is also incrementally linked to the others. Part II covers six different advanced topics in as many chapters in a little under 200 pages. In Part II, the advanced chapters accomplish what most Python books fail to do: show you integrated working examples of how the language is used to solve real-world problems.

For students, Part II allows you to apply directly what you learn from Part I, moving beyond just pushing what might initially be abstract symbols and syntax. For developers or programmers, Part II is a very nice HOWTO, which is strongly backed up by Part I as a language reference. For all users, the book invites exploration and satisfies your curiosity through modifying the copious examples. Some in-depth examination will illustrate these points.

To introduce the basics, Part I has chapter topics titled “Welcome to Python!”, “Getting Started”, “Syntax and Style”, “Python Objects”, “Numbers”, “Sequences: Stings, Lists, and Tuples”, “Dictionaries”, “Conditionals and Loops”, “Files and Input/Output”, “Errors and Exceptions”, “Functions”, “Modules”, “Classes and OOP” and “Execution Environment”.

The order of topics in Part I really simplifies learning Python, especially if this is your first computer language. If you've ever had a programming class before and used a text that has exercises where you were forced to write code that did some silly language-specific action, you'll be pleased to know that this is not that kind of book. Plentiful, practical examples are used as each topic develops; the exercises are a lot more about exercising your creativity rather than some didactic language feature. Consider this one of the “fun” computer language books.

Because of the excellent depth presented in the introductory topics, the material is also of value to practicing Python programmers. For instance, most language books have tables and lists about features that are broadly discussed in the text. This book goes much further. The standard types in Python are explained compellingly in terms of storage model, update model and access model. These three simple concepts explain all of the possible interactions of data types in the language, doing more to help understanding than dozens of pages of prose. And, there are other examples of this kind of thought-provoking mastery of Python. A flowchart explains how Python does numerical coercion and is much easier to follow than any table or list. The best explanation ever achieved of how Python does slicing of sequence objects is shown using cartoons of soccer players. A lot of the power of Python comes from lists and dictionaries. Interestingly, explanations are given for what these objects do not do, as well as for their capabilities. These pages should be earmarked for reference use.

In Part II, we encounter the advanced topics. Again, this is where the book excels: it actually shows you how to do the programming for specific application areas involving “Regular Expressions”, “Network Programming”, “Multithreading Programming”, “GUI Programming with Tkinter”, “Web Programming” and lastly, “Extending Python” with alternative, compiled languages. In contrast to the interlinked development of Part I, the chapters in Part II are more individually self-supporting. They can be used as one has an interest or need for the information. The chapter on multithreading, in particular, is one of the only complete HOWTO developments on this topic.

Mention must be made of the valuable appendices and the index. Appendix A provides answers to selected exercises, for self-checking or class use. Appendix B contains one of the most comprehensive bibliographies of print and on-line references on Python. The operators in Python are conveniently collected in one place in Appendix C. The book keeps you completely up-to-date with Appendix D, which previews the new language features of Python 2.0. The index is impressively comprehensive at 17 pages in length.

The two-part division of the material feels very appropriate. For use as a textbook, the pacing and thoroughness are more than adequate. As a reference book, the clean division of the subject, plus a good index, allow rapid finding of any topic. A wide variety of examples are used in each chapter. This markedly increases the likelihood that something of salience matches your needs as a programmer. And while opinions vary, I tend to prefer books that offer a CD-ROM of multiplatform binaries and sources, as this one does.

Michael Baxter has been working in computer technology since he was nine, imprinted by a 1969 viewing of 2001: A Space Odyssey. He is an experienced computer architect, system, board and FPGA logic designer. Michael holds ten United States patents in computer architecture and logic, plus four patents as a coinventor. His Linux-related interests include open-source Verilog and EDA tools, Python, automated source code generation, concurrency and hardware issues.

__________________________


Special Magazine Offer -- 2 Free Trial Issues!
Receive 2 free trial issues of Linux Journal as well as instant online access to current and past issues. There's NO RISK and NO OBLIGATION to buy. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Sorry, offer available in the US only. International orders, click here.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

linux

On October 2nd, 2007 alchemist enhancing enigma mp3 download (not verified) says:

efficient Linux? under How are threads . Bye.

Featured Videos

Non-linear video editing tools are great, but they're not always the best tool for the job. This is where a powerful tool like ffmpeg becomes useful. This tutorial by Elliot Isaacson covers the basics of transcoding video, as well as more advanced tricks like creating animations, screen captures, and slow motion effects.

Shawn Powers reviews the HP Mini-Note portable computer.

Thanks to our sponsor: Silicon Mechanics

Silicon Mechanics is a leading manufacturer of rackmount servers, storage, and high performance computing hardware. The best warranty offerings available are backed by experts dedicated to customer satisfaction.

From the Magazine

August 2008, #172

There's nuttin like a Cool Project to give you some relief from the summer heat, so get out your parka cuz we got a bunch of em. First up is the BUG, not a bug, The BUG. It's got a GPS, camera and more, in a hand-sized package that's user programmable. The BUG does everything. It's both a floor wax and a dessert topping. Get one now. Need a software version of a Swiss Army knife? Take a look at Billix, and don't leave home without it. Then, chew on this one, an X server on a Gumstix device driving an E-Ink display. Need more storage? How about 16 Terabytes? Can do.

And, of course, we have the usual cast of characters: Marcel, Reuven, Dave, Kyle, Doc, plus the new kid on the block Shawn Powers. But it doesn't stop there: build a MythTV box on a budget, build your own GIS system, set up the tools to monitor your enterprise and more. Finally, remember The War of the Worlds? Now you can play too.

Read this issue