我想知道什么时候使用Python 3 super()的什么风格.
Help on class super in module builtins:
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)
到目前为止,我只使用了super()
,没有参数,而且它(由一名Java开发人员)工作正常.
Questions:
- 在这种情况下,"绑定"是什么意思?
- 绑定和未绑定的超级对象之间有什么区别?
- 何时使用
super(type, obj)
,何时使用super(type, type2)
? - 把超级班命名为
Mother.__init__(...)
会更好吗?