Skip to main content

How To Be Dissappointed in Something You Recommend

I recommend purchasing Expert Python Programming, by Tarek Ziadé. I am extremely disappointed in this book, but I'm recommending it specifically if you already have a good grasp of Python.

You see, I was really looking forward to recommending this book. I had hoped that the many people I know with a good developer head on their shoulders, but had not approached Python with seriousness before, would find this a perfect introduction to sit down with. While I'm really pleased with the writing and structure of the content, I'm afraid this is a book suffering from severe editing oversights. There are subtle mix-ups in terminology in many places and some code samples that are simply and absolutely incorrect.

This is where I made my decision:

>>> from threading import RLock
>>> lock = RLock()
>>> def synchronized(function):
...     def _synchronized(*args, **kwargs):
...         lock.acquire()
...         try:
...             return function(*args, **kwargs)
...         finally:
...             lock.release()
...     return _sychronized
>>> @locker
... def thread_safe():
...     pass

I'm actually not going to point out the actual two mistakes here (I suspect most people that notice will only notice one of them). I want to demonstrate that the problem can be subtle for someone new, but otherwise with a good understanding of software development. This rendered the text applicable to a much smaller readership than it would have otherwise been perfect. I want to repeat how much I really liked the writing, and that I really am recommending it this book. I simply want to express my simultaneous disappointment. I'm really looking forward to posting a glowing review of a second edition of this book.


A closing note...

I sat with this book on myself for the last two weeks trying to decide what to do about my decision on it. Honestly, it was a difficult choice to write about it at all. I am certainly not making any friends at Packt. Make your own decision with this free sample chapter.

Comments

Stephen Thorne said…
It took me a little while to spot the second bug with that example. I think I spotted the 'subtle' bug first :).
Tarek said…
Well, I am soory about this typo.

But this is a Print On Demand book,
so this errata is fixed if you buy it now IIRC.

Errata page: http://atomisator.ziade.org/wiki/Errata
Tarek said…
By the way, I am not sure why you think there's another bug, because the finally block is launched before it returns of course..

try this and see when it goes to sleep:

>>> import time
>>> def f():
... try:
... print 'one'
... return 'three'
... finally:
... time.sleep(5)
... print 'two'
...
>>> f()
one
two
'three'
adam-collard said…
The two bugs I noticed were both typos (assuming the code snippet posted here is an accurate copy from the book).

Firstly the "locker" vs "synchronised" one which is in the Errata, but also "return _sychronised" vs "return _synchronised" (missing n)
Martin Aspeli said…
I think this post is rather too harsh. The roundabout way in which you present your criticism is especially jarring. You are "extremely disappointed", and yet you are still recommending it? You have noticed two errors in a code snippet, and yet you are not prepared to explain what they are, or offer any remedial advice for anyone who may have read this and been confused?

I've only read half of Tarek's book so far, but I think it fills an important gap. It takes a fresh approach, by focusing on tools and good practice, rather than simply semantics.

I happen to have written a book for the same publisher. I can attest to the fact that writing a book this technical is a very difficult and time-consuming job, and the realities of deadlines and day jobs mean that we can never spend as much time as we'd like on testing and re-reading every single line and example. The editors, of course, are not going to have the same degree of expertise as the author (or you) and so can't catch problems, and even with great technical reviewers, some things will get missed. If you've ever written a 300 page piece of text, you'll know. :)

In fact, the process of editing and formatting a book is made pretty difficult by a whitespace-sensitive language like Python (I had this problem in several places when my book when through editing).

Expert Python Programming is not a perfect book, but I think you should be more careful in how you throw about phrases like "extremely disappointed". All books have errata, especially in a first edition. This book is rather good, and I'd definitely recommend it to people who want to be Python "experts" (though not to beginners, of course).

Martin
malthe said…
I'd say that any programmer who's been around for long enough to pick up this book will have no trouble identifying those two typos, cross them over and write in correct replacements.

Coming from a mathematics background, I can safely say that there are fields where error-ridden material can be detrimental. However, the book Tarek has written does not fall into such a category and I would not base any substantial criticism on typographical errors.

Popular posts from this blog

The Insidiousness of The Slow Solution

In software development, slow solutions can be worse than no progress at all. I'll even say its usually worse and if you find yourself making slow progress on a problem, consider stopping while you're a head.

Its easy to see why fast progress is better: either you solve the problem or you prove a proposed solution wrong and find a better one. Even a total standstill in pushing forward on a task or a bug or a request can force you to seek out new information or a second opinion.

Slow solutions, on the other hand, is kind of sneaky. Its insidious. Slow solution is related the Sunk Cost Fallacy, but maybe worse. Slow solutions have you constantly dripping more of your time, energy, and hope into a path that's still unproven, constantly digging a hole. Slow solutions are deceptive, because they still do offer real progress. It is hard to justify abandoning it or trying another route, because it is "working", technically.

We tend to romanticize the late night hacking…

Finding "One Game A Month"

I was really excited about the One Game A Month challenge as soon as I heard about it.
For about two years I've struggled in fits and starts to make my way into game development. This hasn't been productive in any of the ways I hoped when I started. Its really difficult to be fairly experienced as a developer, which I believe I am in my day job as a web developer, while struggling really hard at an area in which your experience just doesn't exist.
Its like being a pilot who doesn't know how to drive.

But this challenge provided a new breath to this little hobby of mine. It gave me a scaffolding to experiment, to learn, to reflect on finished projects. I had spent far too much time on game projects that stretched on far past their exciting phases, bogged down by bad decisions and regret.
And it has worked.
I have a lot to learn. I have a lot of experience to gain through trial and error and mistake and discovery. I have a lot of fun to be had making more small games t…

On Pruning Your Passions

We live in a hobby-rich world. There is no shortage of pastimes to grow a passion for. There is a shortage of one thing: time to indulge those passions. If you're someone who pours your heart into that one thing that makes your life worthwhile, that's a great deal. But, what if you've got no shortage of interests that draw your attention and you realize you will never have the time for all of them?

If I look at all the things I'd love to do with my life as a rose bush I'm tending, I realize that careful pruning is essential for the best outcome. This is a hard lesson to learn, because it can mean cutting beautiful flowers and watching the petals fall to the ground to wither. It has to be done.

I have a full time job that takes a lot of my mental energy. I have a wife and a son and family time is very important in my house. I try to read more, and I want to keep up with new developments in my career, and I'm trying to make time for simple, intentional relaxing t…