summaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-10-19 17:45:06 -0700
committerGitHub <noreply@github.com>2018-10-19 17:45:06 -0700
commitb0f7fa1dda61ae7519deed816993ac5d55870958 (patch)
treebba2fea34e5966dfc9f59cd4a233ebd471845848 /Doc
parent2546ac8eeb56fc146adea9a03158440a9271714e (diff)
downloadcpython-git-b0f7fa1dda61ae7519deed816993ac5d55870958.tar.gz
bpo-21196: Clarify name mangling rules in tutorial (GH-5667)
Initial patch by Chandan Kumar. (cherry picked from commit 13ae4d44381a647aadd09b70b24833052659be41) Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tutorial/classes.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
index 1058b77dd5..9935ccb927 100644
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -651,6 +651,11 @@ breaking intraclass method calls. For example::
for item in zip(keys, values):
self.items_list.append(item)
+The above example would work even if ``MappingSubclass`` were to introduce a
+``__update`` identifier since it is replaced with ``_Mapping__update`` in the
+``Mapping`` class and ``_MappingSubclass__update`` in the ``MappingSubclass``
+class respectively.
+
Note that the mangling rules are designed mostly to avoid accidents; it still is
possible to access or modify a variable that is considered private. This can
even be useful in special circumstances, such as in the debugger.