You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Second, it means that no special syntax is necessary if you want to explicitly reference or call the method from a particular class. In C++, if you want to use a method from a base class which is overridden in a derived class, you have to use the :: operator – in Python you can write baseclass.methodname(self, ). This is particularly useful for init() methods, and in general in cases where a derived class method wants to extend the base class method of the same name and thus has to call the base class method somehow.
Suggested Fix
“基类方式”应为“基类方法”
The text was updated successfully, but these errors were encountered:
Finally, for instance variables it solves a syntactic problem with assignment: since local variables in Python are (by definition!) those variables to which a value is assigned in a function body (and that aren’t explicitly declared global), there has to be some way to tell the interpreter that an assignment was meant to assign to an instance variable instead of to a local variable, and it should preferably be syntactic (for efficiency reasons).
Python Version
3.13
Docs Page
https://docs.python.org/zh-cn/3/faq/design.html#why-self
Original Translation
其次,这意味着当要显式引用或从特定类调用该方法时无须特殊语法。 在 C++ 中,如果你想要使用在派生类中被重写的基类方法,你必须使用 :: 运算符 -- 在 Python 中你可以写成 baseclass.methodname(self, )。 这特别适用于 init() 方法,并且也适用于派生类方法想要扩展同名的基类方式因而必须以某种方式调用基类方法的情况。
Original Docs Paragraph
Second, it means that no special syntax is necessary if you want to explicitly reference or call the method from a particular class. In C++, if you want to use a method from a base class which is overridden in a derived class, you have to use the :: operator – in Python you can write baseclass.methodname(self, ). This is particularly useful for init() methods, and in general in cases where a derived class method wants to extend the base class method of the same name and thus has to call the base class method somehow.
Suggested Fix
“基类方式”应为“基类方法”
The text was updated successfully, but these errors were encountered: