3 ms·
What other patterns do you prefer in Python? Patching feels a bit messy, and if you patch out some imported module "mymod" in the implementation, it breaks whe
by ptx 5y ago
What other patterns do you prefer in Python?
Patching feels a bit messy, and if you patch out some imported module "mymod" in the implementation, it breaks when "import mymod" is changed to "from mymod import myfun", which should be an implementation detail.
You could do something tricky with the import system to substitute modules, I suppose? It seems like this should solve some of the same use-cases as DI, but I haven't seen a clear and straight-forward description of how to go about it in a clean way.