Secret Recipes of the Python Ninja

Author: Cody Jackson
Publisher: Packt Publishing
Pages: 380
ISBN: 978-1788294874
Print: 1788294874
Kindle: B07BYBMGQT
Audience: Python developers
Rating: 3
Reviewer: Alex Armstrong

I've always wanted to be a ninja so this is the book for me - or is it?

Any book that calls itself Secret Recipes of the Python Ninja is setting itself up for a fall. Are the recipes in this book "secret" and what exactly is "ninja" about them?

Of course it doesn't matter what the book is called if it is a great book, even if it doesn't live up to the title.

So in this review I have the split brain problem of working out if this is a book of ninja secrets and, independently, is it a good book anyway.

The first chapter is to be honest very non-ninja like. It covers how to work with Python modules and you get some very simple recipes, like how to import a module, to things that are a little more advanced, like setting up a virtual environment. However, none of this is rocket-science and you can find most of it out by reading the documentation - so hardly secret.

The second chapter continues this exploration of the Python environment by looking into how to use the interpreter. All worthy stuff but not really ninja excitement. A bigger criticism is that none of the material is in the slightest bit off the beaten track - using IPython, for example, is almost standard. About the most esoteric it gets is how to use embedded Python to add the language to another app. Even here though Cody Jackson doesn't go far and even quotes the documentation as a screen dump - where is the "value added"?

Banner

Chapter 3 is more exciting because it finally get us to Python proper rather than dodging round the outsides. It is called Working with Decorators - which is a complicated subject if you don't see the unifying elements. Sadly the chapter starts off talking about functions and methods and, yes, a decorator is used to convert a function to a method, but this isn't really about decorators. A decorator is a callable that accepts a callable and returns a callable and really the only thing you have to do after this is work out what is a callable. Functions are callables and this is obvious, but so are classes and this is less obvious until you remember that they play the role of a constructor function. This chapter is has some helpful examples, but doesn't really nail the concept.

Next we have a chapter on collections and again this isn't secret or advanced. It goes through the very standard stuff on tuples, named tuples, ordered Dicts and so on. Page 123 says

"it doesn't get much better than the original documentation,"

and then goes on to quote an example. Quoting examples from the documentation is fine, but the problem is that it doesn't add much to the explanation. Another minor quibble is that the recipes are all titled "implementing" some data structure or other but the recipes aren't about implementing they are about using the implementations in the standard library.

 

 

Chapter 5 can claim to be a bit more advanced because it deals with generators, coroutines and parallel processing. This is a particularly murky area because Python does it differently to other languages and many would argue not very well - the GIL makes simple multithreading a bit of a joke. The chapter is little more than an introduction to Python async, threading and parallel programming. As Cody Jackson says, books have been written on the topic, and hence his chapter doesn't go very far.

Chapter 6 is a complete let down after the promise of more advanced things in the previous chapter. It covers using the Python math module and it is basically a list of the functions you can use. Do you really need an entry saying exp(x) computes e to the x? If you do you aren't going to understand it anyway.  The later part of the chapter is slightly better and goes into stats and using cryptography. Again it doesn't go very far into any topic.

Chapter 7 returns to Python's periphery with a look at using PyPy to speed things up. If you don't know much about PyPy, then this is a good "what is it and what are the restrictions" introduction. It serves to make you aware of this alternative approach to running Python .

The penultimate chapter is about the PEP system, how it works and how to write a PEP. It then goes on to look at some specific PEPs, which is useful if you want to know what is probably  coming in future versions of Python.

The final chapter is on using LyX to create documentation. Documentation - surely no ninja does documentation. Seriously this is an important topic and the chapter does explain how you can use the tool to document your program.

What is the final verdict?

Well it is clear that this is not about secrets of the ninja anything, it is all on well-documented and fairly standard topics that you might well find in almost any book on Python. If you are expecting a book on using Python in creative ways it is worth noting that four of the chapters aren't even about the Python language but instead its environment and associated technologies.

The topics covered are fairly random and what we have is a book of readings on a range of topics. If you are an intermediate Python programmer then you are likely to either know most of this stuff or know where to find it in the documentation. It isn't so much secrets of the Python ninja more a "what every reasonably good Python programmer already knows". If you are looking for a book with examples of the topics listed then this is a competent, but not inspiring, account.

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Relational Theory for Computer Professionals

Author: C.J. Date 
Publisher: O'Reilly
Pages: 278
ISBN: 9781449369439
Print: 144936943X
Kindle: B00CXXZ6PQ
Audience: SQL Developers
Rating: 5
Reviewer: Kay Ewbank

This book tells you what relational databases are all about in terms of the underlying relational theory, how that works and why [ ... ]



The Fourth Industrial Revolution

Author: Klaus Schwab
Publisher: The Fourth Industrial Revolution
Pages: 198
ISBN: 978-1944835002
Print: 1944835008
Kindle: B01MSJM2TE
Audience: Everyone
Rating: 4.5
Reviewer: Ian Stirk

Our final selection from the book reviews of 2016 aims to be a primer on the fourth industrial revolu [ ... ]


More Reviews

Last Updated ( Tuesday, 21 August 2018 )