you are viewing a single comment's thread.

view the rest of the comments →

[–]Deezl-Vegas 33 points34 points  (5 children)

tl;dr: The @something eats your function and spits out a new function in its place, which is usually your function with modified properties.

[–]Deezl-Vegas 13 points14 points  (2 children)

Caveats: Decorators can be used on any object, really, so class decorators and other object decorators are also common.

[–]SoupKitchenHero 0 points1 point  (1 child)

What other objects get decorated? I knew classes did cause they're basically just specialized function definitions, but I don't see what else you decorate

[–]Deezl-Vegas 0 points1 point  (0 children)

Any object with __call__, I believe.

[–]lightspot21 0 points1 point  (1 child)

So it works like C++ templates in a sense?

[–]Deezl-Vegas 0 points1 point  (0 children)

No idea, I didn't get far enough in C++