observer-pattern

Observers on multiprocessing

Observers on multiprocessing Question: I am doing a GUI that requires of multiprocessing. So I have one process that is the GUI and another process that is running for ever and it’s a scheduler. They share the var scheduler (that keeps the events and manage them) by a manager.list(). When the GUI recibe an input …

Total answers: 2

How to trigger function on value change?

How to trigger function on value change? Question: I realise this question has to do with event-handling and i’ve read about Python event-handler a dispatchers, so either it did not answer my question or i completely missed out the information. I want method m() of object A to be triggered whenever value v is changing: …

Total answers: 6

Implementing a callback in Python – passing a callable reference to the current function

Implementing a callback in Python – passing a callable reference to the current function Question: I want to implement the Observable pattern in Python for a couple of workers, and came across this helpful snippet: class Event(object): pass class Observable(object): def __init__(self): self.callbacks = [] def subscribe(self, callback): self.callbacks.append(callback) def fire(self, **attrs): e = Event() …

Total answers: 2

Python Observer Pattern: Examples, Tips?

Python Observer Pattern: Examples, Tips? Question: Are there any exemplary examples of the GoF Observer implemented in Python? I have a bit code which currently has bits of debugging code laced through the key class (currently generating messages to stderr if a magic env is set). Additionally, the class has an interface for incrementally return …

Total answers: 9