python-dependency-injector
python-dependency-injector copied to clipboard
What is Local context
I tried find examples but attempts were unsuccessful
How I understand: Singleton - One object of all container lifetime ThreadSafeSingleton - Same as Singleton and thread safe
ContextLocalSingleton - What did you mean by Local context ThreadLocalSingleton - Same as ContextLocalSingletonby but thread safe
After practice research - this are look like simple Singleton or ThreadSafeSingleton
I understand a local context as creation singleton object by "with" statement. Found reset_singletons method for container and returns SingletonResetContext is usage in "with" statement. But the method reset all singletons: Singleton, ContextLocalSingleton etc. And singletons reset both in context and in source container. The reset make inside a "with" statement and again after it for every singletons.