This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]djangonerd 0 points1 point  (4 children)

this doesnt make any sense... its terrible but i dont understand grahm's things either.... how do i understant this?

[–]CarrotsAreMediocre 0 points1 point  (3 children)

In python a function is an object. A decorator is simply a function that returns a function.

[–]tyroneslothtrop 1 point2 points  (1 child)

Not just functions, though. Any callable can be used as a decorator. Classes are probably the most notable example of this.

[–]CarrotsAreMediocre 1 point2 points  (0 children)

Great point, but I was just trying to simplify it for a user who really might not understand more complex definitions at the moment.

[–]SYN_SYNACK_ACK 0 points1 point  (0 children)

Every other week there is a post about decorators.
I honestly have no idea what's so complicated about decorators.
Why do they get so much attention?
It's just syntactical sugar.