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
@@ -2152,13 +2152,13 @@ AttributeError: 'Yo' object has no attribute '__honey'
2152
2152
True
2153
2153
```
2154
2154
2155
-
Why did `Yo()._Yo__honey` work? Only Indian readers would understand.
2155
+
为什么 `Yo()._Yo__honey` 能运行? 只有印度人理解.(译: 这个梗可能是指印度音乐人[Yo Yo Honey Singh](https://en.wikipedia.org/wiki/Yo_Yo_Honey_Singh))
2156
2156
2157
-
#### 💡 Explanation:
2157
+
#### 💡 说明:
2158
2158
2159
-
* [Name Mangling](https://en.wikipedia.org/wiki/Name_mangling) is used to avoid naming collisions between different namespaces.
2160
-
* 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.
2161
-
* 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