Python: super

 

  1. super不带任何参数,必须在类中使用, 等价于第一参数为当前类,第二参数为当前函数第一参数(self)

     

     

     

  2. super(type) 一个参数时 没什么用, 不能调用任何方法

     

     



  3. super(type,type2) requires issubclass(type2,type) 未绑定方法, 以type2的mro为基础, 从type(exclude)往后找, 所以type2 必须是type的子类, type2才能在type的mro链上

     

     

     

  4. super(type,obj)

     

     

     

     

     

 

posted @ 2022-09-16 16:47  ascertain  阅读(15)  评论(0编辑  收藏  举报