Simple Function Decorator Sample Snippet

Steven D'Aprano steve at pearwood.info
Tue May 13 01:54:47 EDT 2014


On Mon, 12 May 2014 23:41:18 -0500, Mark H Harris wrote:

> hi folks, I've come up with a simple snippet 

I don't think that this idea is original to you :-) I'm pretty sure many 
people have come up with the idea of a decorator that just announces when 
it runs and when it is called. I know I have  :-) 

People keep independently inventing this because it's an obvious, and 
easy to understand, example. Nicely done.


> that intends to explain the
> concept of decorations without an article (for on app help), while being
> succinct and concise, while not being overly complicated.
> 
> Does this work?   I have another one coming for args, similar, if this
> works...  comments appreciated.  thanks.

I tried to run your code, but every line is quoted with a > which causes 
a syntax error. Was there a reason you quoted the snippet?



-- 
Steven



More information about the Python-list mailing list