How to override parent method preserving signature?

Viewed 29
class Mammal:
    def __init__(self, age: int, name: str):
        """ This is a mammal"""
        self.age = age
        self.name = name
        
class Human(Mammal):
    ??? override Mammal's init preserving its signature:
        super().__init__()
        self.job = job

So when I type Human(<Tab> it should expands Mammal's __init__ signature.

def __init__(self, *args, **kwargs) sucks because it clobbers all the signature and docstring.

def __init__(self, age: int, name: str) still sucks because whenever Mammal's __init__ signature changes I have to rewrite it.

How can I override the parent's __init__ while preserving its signature and docstring?

0 Answers
Related