decorators tutorials

sjdevnull at yahoo.com sjdevnull at yahoo.com
Mon Jul 23 10:41:52 CEST 2007


james_027 wrote:
> Hi,
>
> I am learning python by learning django, and I stumble upon decorator
> which is very cool, any beginners resources for python decorators,
> although I can google it, I just want to get a good tutorial for this
> topic.

Decorators are just a more concise but less obvious way of calling a
defined function on another function.

e.g.
@my_decorator
def foo():
   ...

is the essentially the same as:

def foo():
   ...
foo=my_decorator(foo)




More information about the Python-list mailing list