【二十四】Python中super()详解及应用场景举例(1)
【1】作用
super
也是一个类,是的。他不是一个方法也不是一个内置的关键字。
class A:
pass
print(type(super(A)))
# <class 'super'>
class super(object):
"""
super() -> same as super(__class__, <first argument>)
super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)
super(type, type2) -> bound super object; requires issubclass(type2, type)
Typical use to call a cooperative superclass method:
class C(B):
def meth(self, arg):
super().meth(arg)
This works for class methods too:
class