Closed
Description
Feature
It is a common pattern to inherit a Parent
class and call its __init__()
using *args
and **kwargs
as below.
class Parent:
def __init__(self, a: str, b: int = 0):
print(a, b)
class Child(Parent):
def __init__(self, c: float, *args, **kwargs):
super().__init__(*args, **kwargs)
print(c)
Is there a way of annotating the above *args
and **kwargs
without rewriting Parent
's signature (i.e. no TypedDict
+ Unpack
)?
I would find the following UX very convenient:
class Parent:
def __init__(self, a: str, b: int = 0):
print(a, b)
class Child(Parent):
def __init__(self, c: float, *args: Parent.args, **kwargs: Parent.kwargs):
super().__init__(*args: Parent.args, **kwargs: Parent.kwargs)
print(c)