Author uriyyo
Recipients chaim422, uriyyo
Date 2021-01-03.17:55:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609696540.65.0.855863567187.issue42812@roundup.psfhosted.org>
In-reply-to
Content
> What is better?

Sorry, I can't answer this question.

I am a regular python user and I just tried to help with your issue.

I believe we should wait for someone from core team to answer this question.


> In your example, does Child foo call Parent foo? Because the intent is to use the parent's foo method.

Sorry, I made a mistake, it definitely should call a parent method. A correct example will look like this:
```
class Parent:
    def foo(self, **kwargs):
        """Argument names of foo vary depending on the child class."""


class Child(Parent):
    def foo(self, a, b):
        super().foo(a=a, b=b)
```

But, the example above require more code to write, so a better option will be:
```
class Parent:
    def foo(self, **kwargs):
        """Argument names of foo vary depending on the child class."""


class Child(Parent):
    @overload
    def foo(self, a, b):
        pass

    @overload
    def foo(self, **kwargs):
        pass

    def foo(self, **kwargs):
        return super().foo(**kwargs)
```

I am not sure is it the perfect solution to solve your issue.

Let's wait for someone from core team, so we can hear their opinion.
History
Date User Action Args
2021-01-03 17:55:40uriyyosetrecipients: + uriyyo, chaim422
2021-01-03 17:55:40uriyyosetmessageid: <1609696540.65.0.855863567187.issue42812@roundup.psfhosted.org>
2021-01-03 17:55:40uriyyolinkissue42812 messages
2021-01-03 17:55:40uriyyocreate