I love Flask for simple stuff, but I'm a little concerned that, as someone who considers himself a relatively advanced Python developer, I don't really understand quite a lot of this.<p>I have no doubt that if I dug into it then it would all make sense, but my first instinct is this: how much of this complexity (proxy objects to thread locals, context stacks etc) results from the fact that doing:<p><pre><code> from flask import request
</code></pre>
is just a bad idea?<p>Perhaps things would be easier if instead of:<p><pre><code> from flask import request
...
@app.route('/'):
def index():
return "Hello from %s" % request.args.get('name')
</code></pre>
we did:<p><pre><code> @app.route('/'):
def index(request):
return "Hello from %s" % request.args.get('name')
</code></pre>
I'm probably massively over-simplifying things, but the idea of magically importing state is the one aspect of Flask that always felt a bit odd to me.
If you're interested in this talk, Armin provides the slides and links to video for many of his previous presentations at his website[1]. The talks range from horrific (but useful) Python hackery to an overview of Python web app development.<p>[1]: <a href="http://lucumr.pocoo.org/talks/" rel="nofollow">http://lucumr.pocoo.org/talks/</a>
This presentation, but with notes by Armin:<p><a href="http://dev.pocoo.org/~mitsuhiko/FlaskPatterns_notes.pdf" rel="nofollow">http://dev.pocoo.org/~mitsuhiko/FlaskPatterns_notes.pdf</a>
The video is also on YouTube <a href="http://www.youtube.com/watch?v=KOvgfbBFZxk&feature=youtube_gdata_player" rel="nofollow">http://www.youtube.com/watch?v=KOvgfbBFZxk&feature=youtu...</a><p>Would definitely recommend… I was at the talk yesterday, very clever stuff.
As someone who hasn't used Flask before, this makes me not want to try. I'm not even sure what problem is being solved in this presentation.<p>Anyone care to explain what these advanced patterns are useful for?
Always happy to see Flask related stuff on HN front page :). Being a novice python wannabe, I am still struggling with thread locals but more than happy to keep working with Flask. Reading the source code is fun.