super(): no arguments
时间: 2024-05-19 20:11:30 浏览: 201
Python面试内容很多,干货满满
When calling the `super()` function with no arguments, it is equivalent to calling `super(__class__, self)` which returns a temporary object of the superclass, allowing you to call its methods. This is known as zero argument form of `super()`.
This is commonly used in Python when inheriting from a superclass and wanting to call its methods in the subclass. By using `super()`, you ensure that the correct method is called, even if the method has been overridden in the subclass.
阅读全文