I bought Matt Harrison’s book, Guide To: Learning Python Decorators this week to see if I could finally understand what the big deal was about decorators. I’ve decided to try reviewing this book using Doug Hellman’s method of doing a Quick Review and then a more formal in depth review for those of you hardy enough to want to read more.
- Why I picked it up: Because I wanted to learn about decorators and I also wanted to see how this book compared with Harrison’s other books.
- Why I finished it: Simply put, the book was short and I could read it in between other tasks I was doing. Also, some of Harrison’s insights about functions were really interesting.
- Iâ€™d give it to: An intermediate to advanced Python developer that needed to do meta-programming or had to understand functions and function generators
The only place I can find to purchase this book is on Amazon for their Kindle, even from the author’s website. So I’m guessing mobi is the only format supported at this time unless you can finagle something else out of the author.
This eBook doesn’t really have chapters. They seem more like named sections to me.
Functions – All kinds of information about functions and how they work
Function Parameters – This chapter talks about how *args, **kwargs and what they’re good for. It also talks about “splatting” or flattening using the “*” operator.
Closures – A quick and dirty chapter on what Closures are and how they lead up to Decorators.
Decorators – The last portion of the book is about decorators, of course. It covers simple decorators, decorator templates, parameterized decorators, multiple decorators and a class decorator of sorts.
I found the book to be pretty straight forward and interesting. Most of the time, the author writes in a candid, approachable way. It sounds like a beginner’s book, but I think it would be more appropriate for an experienced beginner to intermediate programmer as Mr. Harrison gets into some heady topics when he gets into function generators, closures and decorators. I saw a typo here and there, but overall, I thought the prose was quite good. Occasionally there were bits that were rather repetitious and there were times where the note sections were stacked up. The problem with stacked notes is that they are kind of mini side pieces and can interrupt the flow of the text.
If you don’t understand the nuts and bolts of functions and you want to finally learn those new fangled decorators, I would recommend this book as a good way to get a handle on these topics.
5 thoughts on “eBook Review – Guide To: Learning Python Decorators”
Mike – Thanks for the review. I hope you feel like you could write one of those new fangled decorator now! I’m wrapping up an exclusivity contract with Amazon through KDP Select right now. There will soon be an epub/mobi/pdf bundle available on my website for those who have issues with the mega-foothold AMZN has on the ebook market.
Matt – I think I understand them better. I kind of want to practice writing a few and maybe do a quickie tutorial on my blog too. We’ll see. Good look with the KDP Select program!
Pingback: Python decorators cheat sheet « Python Adventures
You beat me to the review 🙂 Before reading the book I knew basically what decorators were for but I haven’t implemented them myself yet. The book definitely filled that gap in my knowledge. Some of the earlier text initially doesn’t seem relevant, but it almost all pops up again eventually (so it works as a good intro for people who haven’t looked at the mechanics of function arguments before).
Â Sorry for the delay in approving this. I somehow missed it.
Comments are closed.