__init__ python类中的函数布局

时间:2015-05-06 17:07:22

标签: python python-2.7

类型1:

class Demo(object):
"""docstring for Demo"""
    def __init__(self, arg):
        super(Demo, self).__init__()
        self.arg = arg

或类型2:

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

我使用了 Type 2 ,我毫不怀疑。
{em> Type 1 中super(Demo, self).__init__()的含义是什么?它做了什么?

0 个答案:

没有答案