DanielSank / observed

Observer pattern in python
MIT License
33 stars 4 forks source link

disable default weakrefing #26

Open mateuszzebek opened 2 years ago

mateuszzebek commented 2 years ago

i want to make sure that my observers do not disappear at any circumstance due to weakrefing, garbage collector, etc. - how can i achieve it?

DanielSank commented 2 years ago

You have to keep the observer in scope somewhere in the code. Can you send a self contained minimal working example of the problem you're trying to solve?

DanielSank commented 2 years ago

I think this probably has nothing to do with weakrefing. Weak references are used in this module to make sure that the observers do not prevent garbage collection of the things being observed. The lifetime of observers themselves depends on how your code maintains references to them...