python中super在ipython中的解释。
In [6]: super?
Init signature: super(self, /, *args, **kwargs)
Docstring:
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 C(B):
@classmethod
def cmeth(cls, arg):
super().cmeth(arg)
Type: type
Subclasses:
第一个参数指定起点,
第二个参数是需要绑定的对象,如果是类的话,必须是第一个参数的子类。
如果是对象的话,必须是第一个参数的实例。
浙公网安备 33010602011771号