3 ms·
I do not think the usage of thread locals in Flask is a bad idea. Conceptually request-local variables are no different to stack variables in multiple threads o
by obiterdictum 14y ago
I do not think the usage of thread locals in Flask is a bad idea. Conceptually request-local variables are no different to stack variables in multiple threads of execution, or member variables of objects in OO languages: both change their value depending on some (often) implicit context. We tolerate both, because we've grown accustomed to them.
Server-side web application frameworks are a well-understood and rigid domain: there is only so much variation you can get in the core structure, so it's easy to keep in mind the meaning and scope of Flask's "magic" implicit state variables.
I have used (and continue using) Flask for small- and medium-size projects, and thread-locals so far haven't been a maintenance burden.