1. Passing configuration to the __init__
method which calls register
implicitely:
class Base:
def __init__(self, *verbs):
if not verbs:
verbs = "get", "post"
self._register(verbs)
def _register(self, *verbs):
pass
class Sub(Base):
def __init__(self):
super().__init__("get", "post", "put")
2. 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):
self._register("get", "post", "put")
I use Python 3.
What is better or more pythonic? Or is it only a matter of taste?