3 ms·
I've actually never seen this one before, and I'm not sure if I like it. I generally tend to favor "composition over inheritance", and I'm not sure what the adv
by nerdponx 5y ago
I've actually never seen this one before, and I'm not sure if I like it. I generally tend to favor "composition over inheritance", and I'm not sure what the advantage of inheritance is in this case, compared to standard DI.
- eru 5y agoPython's threads used to work like that, for example. (They still have that as an option, but I think the composition is more preferred these days?)
- nerdponx 5y agoThe old-school way to use Thread is to subclass it and override some methods. The post here is describing a setup where you don't override methods, but instead provide some kind of mixin. I've never seen anyone write this, for example: class MyThreadImpl: def run(self): do_stuff() class MyThread(Thread, MyThreadImpl): pass