re: Don’t say negative things in an interview VIEW POST

re: In short (perhaps I should write an article), global configuration is handled by a singleton, or thread-local. During bootstrapping the desired imp...

A good example of this is Flask. At one point I was using Flask-HTTPAuth and I ran into some issues. I made a suggestion to the maintainer that maybe we could pass certain things into functions via dependency injection (using python decorators). He ended up not going ahead with my suggestion, partly because that's not really how Flask works - the idiom is to use a thread-local "global" object to set and retrieve such information, as @mortoray points out. I did make a small pull request to clean up the code that was accepted though! :) I do tend to prefer the dependency injection concept in general, though one has to be careful with that too. It can be quite easy to create a very complicated configuration where it becomes hard to understand how things are getting set up.

code of conduct - report abuse