# Initialize using Parent
#
class MySubClass(MySuperClass):
def __init__(self):
MySuperClass.__init__(self)
Or, even better, the use of Python's built-in function, super()
(see the Python 2/Python 3 documentation for it) may be a slightly better method of calling the parent for initialization:
# Better initialize using Parent (less redundant).
#
class MySubClassBetter(MySuperClass):
def __init__(self):
super(MySubClassBetter, self).__init__()
Or, same exact thing as just above, except using the zero argument form of super()
, which only works inside a class definition:
class MySubClassBetter(MySuperClass):
def __init__(self):
super().__init__()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…