Consider this
class Base:
def __init__(self, bar: bool, **kwargs) -> None:
self.bar = bar
def foo(self, bar: bool, **kwargs):
...
class Child(Base):
def __init__(self, bar: bool, bar2: int, **kwargs) -> None:
super().__init__(bar, **kwargs)
self.bar2 = bar2
def foo(self, bar: bool, *, bar2: int, **kwargs):
super().foo(bar, **kwargs)
...
How come, pylint raises this only on the method foo and not on __init__?
W0221: Number of parameters was 3 in 'Base.foo' and is now 4 in overriding 'Child.foo' method (arguments-differ)
Childanywhere you could use an instance ofBase, but that doesn't mean you have to create it in the same way.base_consumer(thing=Base(False))andbase_consumer(thing=Child(False, bar2=0))are both OK ifbase_consumercan dothing.foo(True).