|
|
|
|
|
by mercurial
4885 days ago
|
|
Yeah, what you'd end up recreating is a directed graph of dependencies, and make it needlessly fragile. You don't need the big machinery for smaller projects, though. What I end up doing in Python is having builder methods in __init__.py which can instantiate objects from the package (possibly instantiating objects from sub-packages in the process), with any dependency not in the package or sub-packages being a parameter. You get some granularity in your dependency injection, you avoid magic and you don't need to use the builder methods if you don't want to. It may not scale to large class hierarchies, but for mid-size projects it's fine. |
|