Python, Circular Dependencies, And Singletons
I've dug myself into quite a hole here. I'm working on a Python/Kivy app in PyDev. The app runs off of many systems (about 10), so I shoved them into an engine to handle everything
Solution 1:
How about having a "registration" mechanism, where each system
module "registers" itself with the Engine
class using some module-level code:
engine.py
classEngine():
@classmethoddefregister(cls, type):
...
system1.py
from engine import Engine
classSystem1():
...
Engine.register(System1)
That way, the Engine
doesn't directly have to know what gets plugged into it.
Post a Comment for "Python, Circular Dependencies, And Singletons"