diff -r d1eba2645b80 Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst Sun Apr 13 23:52:43 2014 -0400 +++ b/Doc/tutorial/classes.rst Mon Apr 14 12:15:38 2014 +0530 @@ -618,6 +618,21 @@ for item in zip(keys, values): self.items_list.append(item) +The above example would work even if MappingSubclass were to introduce +``__update`` to its symbol table too, since ``__update`` is replaced with +``_Mapping__update`` in the ``Mapping`` class and ``_MappingSubclass__update`` +in the ``MappingSubclass``. For example: + + class MappingSubclass(Mapping): + + def update(self, keys, values): + # provides new signature for update() + # but does not break __init__() + for item in zip(keys, values): + self.items_list.append(item) + + __update = update + 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.