And that a Flask app is a proper WSGI application (as opposed to a self-running Sinatra handler which has to be quite significantly modified to be Rack-compatible)
As a result, the actual verbosity difference comes down to:
@app.route("/")
def hello():
return "Hello World!"
versus get '/hi' do
"Hello World!"
end
So, as usual, Python not having multiline anonymous functions: for this very case you could write app.route('/')(
lambda: "Hello World!")
but that kind-of looks like shit and you're hosed if you want to add more stuff.(one could argue that the Flask version lets you formally write docstrings which standard Python doc tools will understand)
(and if you're wondering, yes Flask could provide support for not needing to define an app or run it for this trivial example, leaving named functions as the only actual overhead over Sinatra. I don't think there's much value in it, but it wouldn't be very hard)