Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我是否应该在重写的子体'中显式调用类对象的init;这是什么?_Python_Python 2.7_Oop_Super - Fatal编程技术网

Python 我是否应该在重写的子体'中显式调用类对象的init;这是什么?

Python 我是否应该在重写的子体'中显式调用类对象的init;这是什么?,python,python-2.7,oop,super,Python,Python 2.7,Oop,Super,对于从类继承的情况,是否有必要显式调用对象的\uuuuu init\uuuu()(如果子体的\uuuu init\uuuu()被重写) class MyClass(object): def __init__(self, arg): super(MyClass, self).__init__() self.arg = arg

对于从类继承的情况,是否有必要显式调用
对象的
\uuuuu init\uuuu()
(如果子体的
\uuuu init\uuuu()
被重写)

class MyClass(object):
    def __init__(self, arg):
        super(MyClass, self).__init__()
        self.arg = arg