python 如何在子类中初始化一个值?

python how to initiate a value in subclass?

我有以下代码:

class Vehicle:
    def __init__(self, name=None, color='Red', make='Toyota'):
        self._name = name 
        self._color = color
        self._make = make

    @property
    def name(self):
        if self._name is None:
            return 'name is none'
        return self._name

    @name.setter
    def name(self, value):
        self._name=value   

    def getColor(self):
        return self._color

    def getMake(self):
        return self._make    

class Car(Vehicle):
    def __init__(self, mode='Running', *args, **kwargs):
        super().__init__(self,  *args, **kwargs)
        self._mode=mode

    def getMode(self):
        return self._mode

我想初始化车名,但是下面的方法都不行。有简单的方法吗?

mycar=Car('Corolla')
mycar=Car(name='Corolla')

不要将 self 传递到 super 绑定 __init__

class Car(Vehicle):
    def __init__(self, mode='Running', *args, **kwargs):
        super().__init__(*args, **kwargs)