Skip to content

Python 3: Dive In

Dive Into Python 3 is an online book the author hopes will lead you to the dead tree version (Dive Into Python 3) at Amazon. Reading through a few chapters tells me it is worth a bookmark to read more. The style is not cumbersome and some ideas appear to be well explained. The chapter Comprehensions gets into file system manipulation to explain.

“Every programming language has that one feature, a complicated thing intentionally made simple. If you’re coming from another language, you could easily miss it, because your old language didn’t make that thing simple (because it was busy making something else simple instead). This chapter will teach you about list comprehensions, dictionary comprehensions, and set comprehensions: three related concepts centered around one very powerful technique. But first, I want to take a little detour into two modules that will help you navigate your local file system.”

That is an interesting insight. Fortran was all about making mathematical expressions easy to program; Cobol for business declarations; and so on. Lists and dictionaries and arrays and such things have often been subject to this sort of effort. It appears Python has its take and Mark calls it comprehensions. “A list comprehension provides a compact way of mapping a list into another list by applying a function to each of the elements of the list.”

Another topic of interest is the description of the changes from Python 2 to Python 3. That provides insight into some of the more severe problems people encountered when writing Python programs as well as those things that are just irritating or needed a bit of finishing. In the severe problems area in this case is the support for Unicode. Strings are no longer just a list of bytes. In the finishing area is making the Print statement look and act like a function. Mark provides an introduction and an appendix that takes on the highlights of the growth of Python with these changes.

Post a Comment

You must be logged in to post a comment.