summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-07-26 14:54:24 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-07-26 14:54:24 (GMT)
commit72db3459e4d949f5ac8df6778b0a0bef8da2e05f (patch)
treef72d1060d6b3c9c54d9c14bc6785c460fb719a86 /Doc
parent59e387eb4034dcc007b0b30eedea4e5fcbc92594 (diff)
downloadcpython-72db3459e4d949f5ac8df6778b0a0bef8da2e05f.zip
cpython-72db3459e4d949f5ac8df6778b0a0bef8da2e05f.tar.gz
cpython-72db3459e4d949f5ac8df6778b0a0bef8da2e05f.tar.bz2
Make indentation comply with our style guide and the rest of the file
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tutorial/classes.rst28
1 files changed, 14 insertions, 14 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
index bf1e26e..6ee2e94 100644
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -598,24 +598,24 @@ occurs within the definition of a class.
Name mangling is helpful for letting subclasses override methods without
breaking intraclass method calls. For example::
- class Mapping:
- def __init__(self, iterable):
- self.items_list = []
- self.__update(iterable)
+ class Mapping:
+ def __init__(self, iterable):
+ self.items_list = []
+ self.__update(iterable)
- def update(self, iterable):
- for item in iterable:
- self.items_list.append(item)
+ def update(self, iterable):
+ for item in iterable:
+ self.items_list.append(item)
- __update = update # private copy of original update() method
+ __update = update # private copy of original update() method
- class MappingSubclass(Mapping):
+ 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)
+ 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)
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