Python: Pocket Primer

Author: Oswald Campesato
Publisher: Mercury Learning & Information
Pages: 265

ISBN: 978-1938549854
Print: 1938549856
Kindle: B00KGF0PJA

Audience: Programmers using the Python 2 branch
Rating: 4.5
Reviewer: Mike James

There is a lot of Python to keep in your head, so a pocket primer sounds like a good idea. 

Primers aren't supposed to be complete introductions to a language and programming - they target the working programmer who perhaps needs to look up a specific topic or refresh their memory of how something works. It is an ideal way of making sure you know what you are doing if you only work in a language occasionally. 

This particular pocket primer is on the very big topic of Python and despite its small page size it probably isn't going to fit into your pocket at 250 pages with a CD bound into the back. I'm not sure why there is a CD in this day and age of the download, but it comes with extra material and solutions to the odd numbered exercises.  

 

Banner

 

The book starts off with a basic intro to Python 2.7.5 - and not Python 3.0. The author makes the case for covering Python 2 as it is still the language you are most likely to find in the real world. I agree, but any new Python program I'm about to write is in Python 3 - unless there is a very good reason and there are increasingly few reasons. 

The chapter covers some ways of running Python but not really enough to give you an idea of exactly the best way of doing it. Then it moves on to the very basics of the language - indentation, quotes, comments and basic numbers. It isn't ordered in difficulty or commonness of use but as connected chunks of knowledge. As it is telling you about numbers you get to learn about formatting numbers and fractions even though in a tutorial these would probably be covered later. In the same way straight after numbers you get sections on string, dates and exception handling. 

The next chapter introduces Python's control structures. Mostly ideas are explained with short, often vague, sentences and then made clear with an example. Sometimes the examples are a bit too long for what they are illustrating. In fact there are places where the examples start to make the book look more like a cookbook of how to do standard tasks rather than an overview of the language. The chapter also covers functions, logical expressions, scope, parameters, lambdas, and recursion. Again the logic of why something is included and the order of presentation isn't obvious but this chapter does more or less get you exposed to most of core Python - minus anything to do with classes. 

From this point on the book deals with increasingly peripheral Python topics. Chapter 3 is about collections - Lists, Arrays, Sets, Dictionaries and so on. It also strays from core Python with a look at what NumPy has to offer.

The next chapter is a long explanation on regular expressions - perhaps more about regular expression than you will need on a day-to-day basis but handy for when you get stuck. Chapter 5 explains files and streams, 6 discusses JSON and XML and 7 goes though data visualization and graphics with IPython, matplotlib, numPy and scipy. These chapters are much more focused on using Python to get particular tasks done than it is about the language. 

 

PythonPocketPrimer

 

Chapter 8 returns to the facilities offered by the core language and looks at the built in functions and custom classes. The object oriented aspects of Python are very under played in the book. Here they are mixed with a look at functional ideas such as filter, map and so on. Classes are introduced without much motivation and we go though the motions of inheritance, encapsulation and polymorphism without any in-depth ideas being explained. What you do get is are some examples, which is fine if you already know about object oriented ideas. Given how important the topic is an entire chapter devoted to a logical introduction of Python classes would have been better. 

The last two chapters move off core Python again as we have a very long chapter on Python and databases. Here you will find out not only about MySQL but a little about MongoDB and at the end about CouchDB and web frameworks such as Flask. The final chapter is simply called Miscellaneous topics and it is mostly on networking, threading, Raspberry Pi and Roomba, Google Glass and Python and Android. All of these are interesting topics but probably not for a primer on Python. 

Overall this is a good book, if you want to brush up on your Python 2.7. It has two big failings - it goes off into too many peripheral topics which are interesting but not to every Python programmer. The second big failing is that it really doesn't do Python class-based programming justice. Many Python programmers never make use of object oriented programming simple writing functions to get everything done. This is a shame and this primer doesn't do anything to change it. 

Despite these problems this is a good primer, and a really good primer if you want to know not just about how the language works, but how to get particular things done - regular expressions, Python and database and so on. It is more like a cross between a primer and cookbook. 

 

Banner


Core Java for the Impatient, 3rd Ed

Authors:  Cay S. Horstmann 
Publisher: Addison Wesley
Pages: 576
ISBN: 9780138052102
Print: 0138052107
Kindle: B0B8RZZBDJ
Audience: Smart programmers wanting in-depth coverage
Rating: 4.8
Reviewer: Mike James

The key to this book is the word "impatient" in the title. What does this m [ ... ]



Python Distilled (Addison-Wesley)

Author: David Beazley
Publisher: Addison-Wesley
Date: September 2021
Pages: 352
ISBN: 978-0134173276
Print: 0134173279
Rating: 4
Reviewer: Alex Armstrong
Python isn't a big language but it's getting bigger all the time.


More Reviews

Last Updated ( Monday, 03 November 2014 )