Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Unified Diff: Doc/tutorial/classes.rst

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Doc/tools/sphinxext/susp-ignored.csv ('k') | Doc/whatsnew/2.5.rst » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/tutorial/classes.rst Tue Jul 26 09:37:46 2011 +0300
+++ b/Doc/tutorial/classes.rst Mon Jul 25 09:47:18 2011 -0400
@@ -595,28 +595,6 @@
without regard to the syntactic position of the identifier, as long as it
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)
-
- def update(self, iterable):
- for item in iterable:
- self.items_list.append(item)
-
- __update = update # private copy of original update() method
-
- 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)
-
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.
« no previous file with comments | « Doc/tools/sphinxext/susp-ignored.csv ('k') | Doc/whatsnew/2.5.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+