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