3 ms·
> And don't even get me started with dependency injection in Python. Could I get you started? Or could you point me to a place to get myself started? I prima
by ryan-duve 2y ago
> And don't even get me started with dependency injection in Python.
Could I get you started? Or could you point me to a place to get myself started? I primarily code in Python and I've found dependency injection, by which I mean giving a function all the inputs it needs to calculate via parameters, is a principle worth designing projects around.
- deleted 2y ago[deleted]
- d0mine 2y agoHere’s 1% that gives 50% of result. Replace: class C: def __init__(self): self.foo = ConcreteFoo() with: class C: def __init__(self, foo: SupportsFoo): self.foo = foo where SupportsFoo is a Protocol. That’s it.