K
K
Kirill Semenov2016-05-09 23:52:15
Python
Kirill Semenov, 2016-05-09 23:52:15

Passing parameter to python decorator?

What does @app.route("/") mean? Not what it does, but what it means in python. The only thought is calling a decorator with a parameter, but this is nonsense in my opinion.

app = Flask()

@app.route("/")
def nothing():
    pass

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2016-05-10
@esnote

A description and valid syntax for function decorators is given in function-definitions .
On my own, I’ll add that I understand the decorator syntax with brackets as a kind of function of the decorator factory, although this is clearly not written anywhere in the documentation, but such a decorator is implemented in this way.

S
sim3x, 2016-05-10
@sim3x

https://github.com/pallets/flask/blob/2bf477cfeafd...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question