[Tutor] decorators -- treat me like i'm 6.. what are they.. why are they?

Danny Yoo dyoo at hashcollision.org
Wed Jul 6 20:33:23 EDT 2016


> As to who suggested them you'd need to go back through the
> PEPs to see who first suggested it, and then maybe more to see
> who's idea finally got accepted. I think it was in Python 2.5.


Hi Bruce,


Yes, it happened back around 2003:

    https://www.python.org/dev/peps/pep-0318/

Decorators are "syntactic sugar" in the sense that they can be
rewritten in terms of more primitive parts of the language (function
calls).  If you already know about functions that work on functions,
then you know what decorators are.

However, if you haven't seen the concept of functions that take
functions as input, and you want to talk about that, feel free to ask
questions!  It would likely be a "fun" discussion to have.


More information about the Tutor mailing list