1

I'm new in python. And I can't seem to figure why sometimes in tutorials and examples you see the "@" sign before a variable

the basic flask app look like so:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello ():
     return "Hello World!"

if __name__ == "__main__":
     app.run()

So how come they need to use the @ sign and when can I use it?

Izikon
  • 902
  • 11
  • 23

1 Answers1

1

They are called decorators. Please refer to: https://www.python.org/dev/peps/pep-0318/

Andrés Pérez-Albela H.
  • 4,003
  • 1
  • 18
  • 29