Mercurial > cpython-lru_cache-weakref
diff Doc/tutorial/classes.rst @ 44383:3625234bf3d2 legacy-trunk
Some cleanup in the docs.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Sat, 29 Dec 2007 10:57:00 +0000 |
| parents | 03056365a1b6 |
| children | 15746bf4a0a6 |
line wrap: on
line diff
--- a/Doc/tutorial/classes.rst Fri Dec 28 04:18:01 2007 +0000 +++ b/Doc/tutorial/classes.rst Sat Dec 29 10:57:00 2007 +0000 @@ -341,7 +341,7 @@ Random Remarks ============== -.. % [These should perhaps be placed more carefully...] +.. These should perhaps be placed more carefully... Data attributes override method attributes with the same name; to avoid accidental name conflicts, which may cause hard-to-find bugs in large programs, @@ -457,7 +457,7 @@ have no special privileges when calling other methods of the same object, a method of a base class that calls another method defined in the same base class may end up calling a method of a derived class that overrides it. (For C++ -programmers: all methods in Python are effectively :keyword:`virtual`.) +programmers: all methods in Python are effectively ``virtual``.) An overriding method in a derived class may in fact want to extend rather than simply replace the base class method of the same name. There is a simple way to @@ -574,12 +574,10 @@ can define a class with methods :meth:`read` and :meth:`readline` that get the data from a string buffer instead, and pass it as an argument. -.. % (Unfortunately, this -.. % technique has its limitations: a class can't define operations that -.. % are accessed by special syntax such as sequence subscripting or -.. % arithmetic operators, and assigning such a ``pseudo-file'' to -.. % \code{sys.stdin} will not cause the interpreter to read further input -.. % from it.) +.. (Unfortunately, this technique has its limitations: a class can't define + operations that are accessed by special syntax such as sequence subscripting + or arithmetic operators, and assigning such a "pseudo-file" to sys.stdin will + not cause the interpreter to read further input from it.) Instance method objects have attributes, too: ``m.im_self`` is the instance object with the method :meth:`m`, and ``m.im_func`` is the function object
