@@ -598,24 +598,24 @@ occurs within the definition of a class.
598598Name mangling is helpful for letting subclasses override methods without
599599breaking intraclass method calls. For example::
600600
601- class Mapping:
602- def __init__(self, iterable):
603- self.items_list = []
604- self.__update(iterable)
601+ class Mapping:
602+ def __init__(self, iterable):
603+ self.items_list = []
604+ self.__update(iterable)
605605
606- def update(self, iterable):
607- for item in iterable:
608- self.items_list.append(item)
606+ def update(self, iterable):
607+ for item in iterable:
608+ self.items_list.append(item)
609609
610- __update = update # private copy of original update() method
610+ __update = update # private copy of original update() method
611611
612- class MappingSubclass(Mapping):
612+ class MappingSubclass(Mapping):
613613
614- def update(self, keys, values):
615- # provides new signature for update()
616- # but does not break __init__()
617- for item in zip(keys, values):
618- self.items_list.append(item)
614+ def update(self, keys, values):
615+ # provides new signature for update()
616+ # but does not break __init__()
617+ for item in zip(keys, values):
618+ self.items_list.append(item)
619619
620620Note that the mangling rules are designed mostly to avoid accidents; it still is
621621possible to access or modify a variable that is considered private. This can
0 commit comments