Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is Local context #804

Open
DGDarkKing opened this issue Jul 12, 2024 · 1 comment
Open

What is Local context #804

DGDarkKing opened this issue Jul 12, 2024 · 1 comment

Comments

@DGDarkKing
Copy link

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.

@gtors
Copy link

gtors commented Jul 20, 2024

Learn about contextvars in async Python and you will get answers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants