This question, is a followup to this one.
When using super()
for multiple inheritance, the suggested approach was to use keyword arguments to pass remaining values up the call chain.
When using the ABC
module, is it good practice do the same in the super().__init__
method?
The blog post, which the Python documentation about super()
links to, doesn't mention anything about using **kwargs
and the ABC
module. It's focused on multiple inheritance with concrete classes. To rephrase my question, does the advice about using **kwargs
with super()
apply to classes that use the ABC
module?
For example:
from abc import ABC
class GameWeapon(ABC):
def __init__(self, name, damage, **av):
super().__init__(**av)
self.name = name
self.required_strength = required_strength
self.damage = damage
class ChargeGun(GameWeapon):
def __init__(self, name, required_strength, damage, **av):
super().__init__(name=name,damage=damage,**av)