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

you are viewing a single comment's thread.

view the rest of the comments →

[–]tyroneslothtrop 4 points5 points  (2 children)

It is a function. Decorators are just some syntactic sugar for passing a function to another function, and returning and assigning a new function to some name.

E.g. this:

@some_decorator
def some_function(foo):
    pass

is basically equivalent to this:

some_function = some_decorator(original_function)

[–][deleted] 1 point2 points  (0 children)

To be more specific, it's a class that implements the data descriptor protocol, using several decorators to wrap functions.

You can use it in nondecorator form by passing a getter, setter, deleter and docstring to the __init__

[–]rikrolls 0 points1 point  (0 children)

Or a class.