类(对象)的超级super用法————到底有什么卵用?

hi大佬们好,搬砖辛苦了。

这里遇到一个情况,就是在类定义函数(方法)时总是再super一下,这个操作有什么用呢?在youtube中也曾见到,Be sure to call this somewhere or something else,traditionally you can see super in __init__, but you do not know why, so what's the meaning of the super ?

For Video Recommendation in Deep learning QQ Group 277356808
 

视频推荐加这个群,别加错。

For Visual in deep learning QQ Group 629530787
 

视觉深度学习加这个群。

I'm here waiting for you

只加一个就好

 If I do not set the sentence, will happen what ?

搜了下相关博文,有的说继承啥的,必须一样啥的,我想说,不一定,可以改写,也可不要super,总之就是没啥卵用,纯属装逼

先定义一个类,如下:注释的部分都是可行的,其他错误的也有示例

 

猜你喜欢

转载自blog.csdn.net/SPESEG/article/details/108320264
今日推荐