Commit 13ae4d44 authored by Berker Peksag's avatar Berker Peksag Committed by Victor Stinner

bpo-21196: Clarify name mangling rules in tutorial (GH-5667)

Initial patch by Chandan Kumar.
parent 83460311
...@@ -703,6 +703,11 @@ breaking intraclass method calls. For example:: ...@@ -703,6 +703,11 @@ breaking intraclass method calls. For example::
for item in zip(keys, values): for item in zip(keys, values):
self.items_list.append(item) 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 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 possible to access or modify a variable that is considered private. This can
even be useful in special circumstances, such as in the debugger. even be useful in special circumstances, such as in the debugger.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment