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
@@ -2157,13 +2157,13 @@ AttributeError: 'Yo' object has no attribute '__honey'
2157
2157
True
2158
2158
```
2159
2159
2160
-
Why did `Yo()._Yo__honey` work? Only Indian readers would understand.
2160
+
为什么 `Yo()._Yo__honey` 能运行? 只有印度人理解.(译: 这个梗可能是指印度音乐人[Yo Yo Honey Singh](https://en.wikipedia.org/wiki/Yo_Yo_Honey_Singh))
2161
2161
2162
-
#### 💡 Explanation:
2162
+
#### 💡 说明:
2163
2163
2164
-
* [Name Mangling](https://en.wikipedia.org/wiki/Name_mangling) is used to avoid naming collisions between different namespaces.
2165
-
* In Python, the interpreter modifies (mangles) the class member names starting with `__` (double underscore) and not ending with more than one trailing underscore by adding `_NameOfTheClass` in front.
2166
-
* So, to access `__honey` attribute, we are required to append `_Yo` to the front which would prevent conflicts with the same name attribute defined in any other class.
0 commit comments