The Startup
Published in

The Startup

Python Decorators Explained

If you’ve spent even a little bit of time using common Python frameworks, such as Flask, you’ve undoubtedly seen decorators in use. These little tags are placed on top of a function declaration to indicate that it’s used for something special. This simple example from the Flask web site shows off a typical use case:

app = Flask(__name__)@app.route('/')
def hello():
name =…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store