[question] strategy pattern class methods
arcturus140 opened this issue · comments
Arcturus commented
hi, thank you for this amazing repository. I don't understand why the strategy pattern is not an abstract class, i.e., using @abc.abstractmethod
. Was it done this way to provide a default strategy?
Sakis Kasampalis commented
Hi,
The simple answer is because you don't have to do it. Python gives you both options. a) Use the abc module to define a formal interface. b) Be informal and rely on duck-typing. The first option might help you to discover problems earlier (e.g. Pycharm will warn you if you don't conform to an interface). The second option gives you more flexibility when experimenting/prototyping