Hacker News new | ask | show | jobs
by molbioguy 5385 days ago
An excellent tutorial/answer about python decorators was posted on stack overflow:

http://stackoverflow.com/questions/739654/understanding-pyth...

3 comments

I would replace "excellent" with "extremely thorough."

I would recommend the posted link for a first introduction -- it's short, explains decorators as clearly but more approachably, and talks about their application to classes, something the SO answer misses.

Thanks for the link. As a python newbie, the way that helped me best was going through the stack overflow link and then the posted article. From what I understand its also important to understand when the decorator function is executed. Before or after the function it decorates.(I understand its also possible, that it executes both before and after). Is this understanding correct?
Agreed, I read that one as well. What struck me was the link the author drew to LISP macros.