Kindle Price: $4.99

Save $3.98 (44%)

These promotions will be applied to this item:

Some promotions may be combined; others are not eligible to be combined with other offers. For details, please see the Terms & Conditions associated with these promotions.

Deliver to your Kindle or other device

Deliver to your Kindle or other device

Flip to back Flip to front
Audible Narration Playing... Paused   You are listening to a sample of the Audible narration for this Kindle book.
Learn more

Guide to: Learning Python Decorators Kindle Edition

26 customer reviews

See all 3 formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle
"Please retry"
$4.99

Length: 45 pages

Best Books of the Month
Best Books of the Month
Want to know our Editors' picks for the best books of the month? Browse Best Books of the Month, featuring our favorite new books in more than a dozen categories.

Editorial Reviews

Review

Succinct, focused
This inexpensive ebook is a little gem. Matt gives tight, crystal clear explanations that I haven't found anywhere else.
- J. Adams
 
 
Cleaned up some ugly with closures today, after reading @__mharrison__'s decorators ebook.
- @MattJDarling

About the Author

Matt Harrison Matt Harrison has over 11 years Python experience across the domains of search, build management and testing, business intelligence and storage.
He has presented and taught tutorials at conferences such as SCALE, PyCON and OSCON as well as local user conferences. The structure and content of this book is based off of first hand experience teaching Python to many individuals.
He blogs at hairysun.com and occasionally tweets useful Python related information at @__mharrison__.

Product Details

  • File Size: 411 KB
  • Print Length: 45 pages
  • Simultaneous Device Usage: Unlimited
  • Publication Date: January 18, 2012
  • Sold by: Amazon Digital Services, Inc.
  • Language: English
  • ASIN: B006ZHJSIM
  • Text-to-Speech: Enabled
  • X-Ray:
  • Word Wise: Not Enabled
  • Lending: Enabled
  • Enhanced Typesetting: Not Enabled
  • Amazon Best Sellers Rank: #349,027 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
  •  Would you like to give feedback on images?


More About the Author

Matt Harrison has over 10 years Python experience across the domains of search, build management and testing, business intelligence and storage.

He has presented and taught tutorials at conferences such as SCALE, PyCON and OSCON as well as local user groups. In addition he has been a private tutor teaching programming to teenagers as well as retired folk. The structure of his books are based off of his first hand experience teaching Python to many individuals.

Customer Reviews

Most Helpful Customer Reviews

18 of 18 people found the following review helpful By Richard Careaga on February 6, 2012
Format: Kindle Edition Verified Purchase
Once past "hello, world!" most beginners go through a long period of monkey-see-monkey-do learning to cobble together a collection of phrases that seem to work, although you're never exactly sure why. Eventually you run up against problems that you can't find a good example for and you have to do the hard work of understanding exactly what it is that you have asked your code to do. This is the beginning of the real learning.

One of the terms that floats around is the mysterious "decorator" that never seems urgent enough to look into, although they turn out to be quite useful. If you have been meaning get around to looking into this, the Guide to Learning Python Decorators is the place to start. But that's actually not the compelling reason for most Python newcomers to pick up this book.

A common source of beginner confusion is the "scope" of variables in functions: "I've written this function and it takes some values as input and derives a result through multiple steps. I can get the final result, but not all the intermediate variables that I've set. What gives?" This and similar questions arise from confusion as to when names are available within a function definition and when they are available to other functions and statements. It's sort of like trying to understand a language without knowing the difference between the present tense ("I am") and the past tense ("I was").

This book will clear up your confusions about functions even before you start to read about decoration at all. In addition to getting straight about scope, you'll finally get clarity about the difference between arguments and parameters, positional parameters, named parameters, etc.
Read more ›
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
6 of 6 people found the following review helpful By Amjith on February 7, 2012
Format: Kindle Edition
This is a concise guide that covers all the necessary background in order to understand decorators.

Although many python programmers use decorators in their code, very few know how to write a decorator. Writing a decorator is considered an advanced skill and this book does an excellent job of demystifying it.

The book has dedicated sections to cover nested functions, variable function parameters, the * operator (*args, **kwargs) and closures, which are all advanced concepts that lead up to decorators.

This books serves as a stand-alone manual to python decorators. I'd highly recommend it for beginners and experts who are trying to level-up their python chops.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
6 of 6 people found the following review helpful By Aviah Laor on February 20, 2013
Format: Kindle Edition Verified Purchase
A clear and concise book. The author clearly explains the issue, bottom up: python functions, arguments, parameters, closures and finally decorators. The english is clear, so it's easy to understand the concept.
However, for a price of a full book, you could expect some advanced material: more about multiple decorators (which are only reminded in one page at the end), exceptions, detailed examples of common usage, class decorators etc.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
4 of 4 people found the following review helpful By Stephen Ferg on May 13, 2012
Format: Kindle Edition Verified Purchase
Recently, in a post titled "Python decorators" on the PythonConquersTheUniverse blog, I described what I think is wrong about most introductions to decorators, and I sketched out what I think is a better way to structure an introduction to decorators. In that post I wrote this:

There is an old saying to the effect that "Every stick has two ends, one by which it may be picked up, and one by which it may not." I believe that most explanations of decorators fail because they pick up the stick by the wrong end.

What I like about Matt Harrison's e-book "Guide to: Learning Python Decorators" is that it is structured in the way that I think an introduction to decorators should be structured. It picks up the stick by the proper end.

The first two-thirds of the Guide hardly talk about decorators at all. Instead, Matt begins with a thorough discussion of how Python functions work. By the time the discussion gets to decorators, we have been given a strong understanding of the internal mechanics of functions. And since most decorators are functions, at that point it is easy for Matt to explain the internal mechanics of decorators.

Which is just as it should be.

So I am happy to rate "Guide to: Learning Python Decorators" as HIGHLY RECOMMENDED.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
4 of 4 people found the following review helpful By Jerzy Gawad on July 2, 2013
Format: Kindle Edition Verified Purchase
The book isn't really about decorators.Well, it gives a very nice introduction to functions in Python. I also admit that it clearly explains the concept of closures.

But then we directly jump into the chapter about decorators. It mentions a few contexts in which decorators might be handy. The author explains how to construct decorators. And then... the book is over. It is neither a thorough study how to use the concept, nor a handful of hints...

There are many code examples in the book. Unfortunately, some are clearly wrong. It appears that the author didn't test these examples before putting them into the text.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
2 of 2 people found the following review helpful By Christopher on March 14, 2013
Format: Kindle Edition Verified Purchase
If you have never looked at or written python decorators before, this is a good book to go through the background of how and why they work, and a few examples of them in action.

It is a well written guide, however it did seem like just as you were getting to what would be the good detailed examples or advanced use cases the book just ended.

Edit: After having this book for a few months it has become very useful as the goto reference anytime I have to use decorators. For how much use I have gotten out of this guide it is definitely worth it.
2 Comments Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Forums

There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
Topic:
First post:
Prompts for sign-in