Programming in Python 3I was quite pleased with the topics covered. Besides a good introduction to the language, there were many specialized topcs, some of great value to a working programmer. As an example, the chapter on file handling has extended discussions on binary files (converting binary data to and from Python internal representations), handling XML files, parsing text files, and handling random access to binary files, as might be required in a database.

I do wish there was a section covering the differences between Python 2 and Python 3. I would have found it useful, although this information is available from many sources on and offline.

The book begins with chapter on Python's “beautiful heart”, a quick overview of Python as a procedural language. By the end of this chapter the reader knows how to install Python 3, and create and execute simple programs.

Chapter 2 covers data types, and includes good coverage of string formatting and character encodings, including UTF.

In Chapter 3, the collection types are explained. In particular, some newer data types are discussed, including named tuples and default dictionaries. A named tuple is one in which has a type name and named fields, and so is almost a lightweight class. Default dictionaries are specified with a type, such int(). When a key is requested that has not been initialized, the default value of that type will be returned; for example, zero when the default type is int(). This too is close to being a lightweight class. Also covered are set and dictionary comprehensions. These, like the familiar list comprehensions, are a compact way of specifying a set or dictionary without having to create a for-loop.

Chapter 4 discusses control structures and functions. It is complete and for the most part clear. I thought the discussion of lambda functions, while covering the subject, might be a bit short for someone who had not seen the concept before. The section on assertions, an area of Python I hadn't looked at before, was more extended and quite good.

Modules and packages are covered in Chapter 5. There is an introduction to the concepts of modules and packages and then a quick overview of the standard library, divided by functional areas. This would be enough to allow someone using the book to know where to look for details on the major tasks that come up, such as string processing, or interacting with the file system to manage paths.

Chapter 6 discusses object oriented programming. There is a concise introduction to O-O concepts and then the Python 3 specifics. I was pleased to see good coverage of the “special methods”, such as __eq__(), or the arithmetic operators. Usually these are presented as an advanced technique, and not taught immediately. There is also a good discussion of custom collection classes, and to protocols that must be observed for use with iterators or generators. These topics are good examples of the book's usefulness for already experienced programmers who are creating complex systems with Python 3.

In Chapter 7, there is excellent coverage of file handling. Once again, the discussion turns to fairly advanced topics at once, such as pickling (writing and reading data in an internal Python-specific format), using byte arrays to handle binary data, parsing text files, XML, and using random access binary files.

Advanced programming topics are covered in Chapter 8.
For procedural programming, high points include dynamic code creation, decorators, and function annotation. There is an example using decorators and annotations to allow a form of strict typing in function definitions.
On the object oriented side, a number of valuable techniques are covered. Highlights include:

\* Functors: A functor is created by a class which has a __call__() method, so the object can be treated as a function object and invoked directly, yet the full power of an object with internal state can be utilized.

\* Context managers: classes which handle their own setup and cleanup. For example, there are file objects, which are opened at creation, and automatically close their file handle when garbage collected as they go out of scope.

\* Abstract Base Classes (ABC): Familiar to Java programmers, these classes are intended to be inherited, and they define interfaces for subclasses. For example, there is a Collections module that has many Abstract Base Classes that can be implemented by a custom collection class. The standard collections, such as list() or dict(), are subclasses of ABCs defined in Collections.

\* Metaclasses: A class can be registered with a metaclass to indicate that it obeys the metaclass's protocol. For example, a custom collection could be registered with the appropriate class in the Collections hierarchy. This compels the registered class to have the required methods of the metaclass, and the metaclass has a degree of control over the instantiation of the registered class.
There is also a discussion of Functional Programming, including the use of the functools module.

Processes and Threads are discussed in Chapter 9. The presentation on processes is limited to the use of pipes to communicate with a subordinate process, and there is no mention of the more general fork(), exec(), wait(), usage of subprocesses. The threading section is more complete. A complete worked example shows the use of worker threads. Synchronization is shown, as that is needed for non-GIL implementations of Python.

In Chapter 10, networking is covered, using the socket module, and a TCP client and TCP server are used as example programs. These examples show many of the issues of data representation when transmitting information over a network.

Python for databases is shown in Chapter 11. There is section on interfacing with DBM databases using the built-in shelve module. There is also good coverage of interfacing with SQL databases using the DB-API protocol, a valuable topic for the working programmer.

Regular Expressions are covered in Chapter 12. The discussion is complete, including newer features of the regular expression syntax, and the use of match variables to read back the results of using a regular expression.

Chapter 13 discusses GUI programming, using the tkinter module to create a bookmarks management program that handles (name, URL) pairs. The process is described in steps and includes creation of a custom dialog.

Finally, the index is extensive, a very important and valuable addition for any technical book.

In summary, I recommend this book to any experienced programmer who needs to get up to speed on Python 3 and its use in modern programming environments. For those who are familiar with Python 2, a list of differences between the two versions should be used, as well.