-
Notifications
You must be signed in to change notification settings - Fork 82
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
Documentation: "Using Scopes to manage Resources" #252
base: master
Are you sure you want to change the base?
Conversation
docs/scopes.rst
Outdated
connections. If those resources are shared between multiple classes and should | ||
not be freed and reallocated in between, then using the :class:`SingletonScope` seems | ||
to be the right choice. However resources are not freed automatically afterwards | ||
and bookkeeping must be done manually. However to with some small additions to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, remove to
.
Thank you very much for the contribution @bschnitz, it's always nice to see a documentation patch. May I ask about the exact use case you're addressing here? Is it primarly/only about being able to do this?
If yes, then it seems to me it's enough for Then |
Hi @jstasiak , thank You for having a look! Actually, thats not the whole idea and I have to admit, that the example is too short to grasp it correctly. The idea is, that all objects in CleanupScope are handled, not just the one we directly get in this example. So it's really the context of the Scope and not the one of the object, although it looks a bit misleading here. The usage of I will extend the example a bit, then You may have a look again. Oh, this person named Edit: I extended the motivation a bit. It still feels clumsy, but I hope the idea is clearer now. If You have ideas on improving my horrible writing, feel free to tell ;). |
09274c9
to
40533ba
Compare
I tried to make a minimal example on how to automatically free resources with a custom
Scope
. Since I'm still learning how to use the python-injector, there may be many misconceptions, so please have a firm look.