Hello. My name is Noemi Millman, and Triopter is my web development agency. We handcraft beautiful, dynamic websites.

See what I can do for you.

Noemi Millman: Triopter: Deco-What?


I’ve said before that I’m only a moderately experienced programmer.  One of the things I’m enjoying about learning Django is that it’s challenging me to pick up new concepts without getting bogged down in the details of implementation.
Yesterday I ran across decorators.  I had no idea what a decorator is, how it works, or what it’s used for.  Wikipedia offers an overview, which at least explains the general purpose, but then someone tells me that Python decorators are not the same thing.  The top Google results fly way over my head, and finally, I land on an example that makes sense.

So, to my understanding, a decorator is a function that gets wrapped around a second function.  When the second function is called, the decorator is effectively called instead, and it calls the second.  I could be completely misled, but I’m going to run with that for now.  If I’m wrong, won’t someone please please please correct me?

Post a Comment

Your email is never published nor shared. Required fields are marked *

Comments may be held for moderation to prevent spam: your comment may not appear immediately.