How to get attribute to subclass?
I mean the part age=age
def method(name='thomas', age=27):
submethod(age=age)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not totally sure what you mean by this code, is the submethod abstract?
Anyway, you’re missing
self, that’s not a method. This should work:If the submethod argument is keyword only, you could rename the local argument value for clarity:
Or just don’t, keyword names don’t collide with local variables anyway, so your original code works once you add the
self: