[x^2 for x in lst]

The Quick Python Book

Author: Naomi Ceder

Review created: 2019-07-20

The Quick Python Book is an introductory book to the Python programming language written by the well known pythonista Naomi Ceder.

The book is divided into four parts:

  • Starting out
  • The essentials
  • Advance language features
  • Working with data

Each part is divided into a number of chapters, 24 in total. The chapters are rather short, which is a thing that I like a lot as short chapters makes it possible to finish a whole chapter in one reading session.

It is a comprehensive book that contains most of what you need to know about basic, and not so basic, Python. The names of the chapters are:

  • About Python
  • Getting started
  • The Quick Python overview
  • The absolute basics
  • Lists, tuples, and sets
  • Strings
  • Dictionaries
  • Control flow
  • Functions
  • Modules and scoping rules
  • Python programs
  • Using the filesystem
  • Reading and writing files
  • Exceptions
  • Classes and object-oriented programming
  • Regular expressions
  • Data types as objects
  • Packages
  • Using Python libraries
  • Basic file wrangling
  • Processing data files
  • Data over the network
  • Saving data
  • Exploring data
  • Case study
  • Appendix A: A guide to Python’s documentation
  • Appendix B: Exercise answers

As you can see from the list of chapters, the book covers a lot of material. Despite that fact, it is such an easy read that it only took about a week to finish it. OK, I was on holiday when I read it, but anyway.

Interwoven with the main text is questions and exercises designed to test your understanding of the stuff you've just read. Answers to these questions and exercises are supplied in an appendix. I like this approach very much. First, it is good that the book contains exercises at all, second it is good that the exercises are not left to the end of the chapter - so that you haven't already forgotten the stuff the question is about and third it is good that there are answers so that you can verify that your solution is correct. I wish that more books would adopt this approach.

The edition I read was the third one. It covers version 3.6 of Python, but has been tested on an alpha version of 3.7. I used Python 3.7.3 and had no problems running any of the example programs in the book. If you, for some reason, want to run the example code using Python 2, then you have to change a thing or two.

The book is not an introduction to programming. You need to be able to write programs in another programming language before reading this book. Other than that, there are no prerequesitives (except for having a computer with an OS that Python runs on of course). The book will tell you how to download and install Python, how to use the python interactive shell, advice you on which editor to use and so on. All this is included in the first part of the book.

Both the object-oriented and the iterative approaches to programming are described in the book. Not the functional approach however, so if you want to learn more about functional programming in Python you probably should buy another book (preferably after having read this one first ;)

The last part of the book concentrates on how one can read, process and save data in some various common formats using Python. Those chapters contain very useful information for anyone working on with handling and transforming data in e.g. csv-format. One of the chapters in this part of the book concentrates on how Python can interface with different kinds of databases, either directly or via an ORM (SQLAlchemy). SQLite and MongoDB is used as example databases. When reading these chapters, it really feels as if the author has worked with the things that are described in them. These chapters are for the working programmer, not so much for a hobbyist or a computer science student.

When reading the book, you notice that the author is really deep into the Python community and also has worked a lot in the software development industry. This gives you confidence that the stuff that she writes is both correct and relevant, which is a good thing as reading an irrelevant book is a waste of effort.

One thing that I miss in the book is a description on how to write unit tests in Python. The only information related to unit tests that I can find in the book is that the unittest module is listed in one of the tables. I really would have liked it if some discussion on unit testing had been included in the book.

Summary: The Quick Python Book is a really good introduction to Python. It will teach you most things that you need to know to write good, solid Python programs. It is written in an accessible, no nonsense style which makes it easy to finish in a short amount of time. I would recommend it to anyone wanting to learn how to program Python 3 in an iterative or object oriented way. If you want to learn Python 2 or functional programming using Python 3: please choose another book. The book also get extra marks for choosing MongoDB as one of the databases discussed. Accessing MongoDB from Python is really disgustingly easy :)