Calling methods in super class constructor of subclass constructor?
Passing configuration to the __init__ method which calls register implicitely:
class Base:
def __init__(self, *verbs=("get", "post")):
self._register(verbs)
def _register(self, *verbs):
pass
class Sub(Base):
def __init__(self):
super().__init__("get", "post", "put")
Or calling register explicitely in the subclass' __init__ method:
class Base:
def __init__(self):
self._register("get", "post")
def _register(self, *verbs):
pass
class Sub(Base):
def __init__(self):
_register("get", "post", "put")
What is better or more pythonic? Or is it only a matter of taste?