diff options
author | Georg Brandl <georg@python.org> | 2007-12-29 10:57:00 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-12-29 10:57:00 (GMT) |
commit | b19be571e09263239ef29c92eee06dbb30186685 (patch) | |
tree | 9c8a5439b14ce34cfaa0e4e164483b0f8690aa42 /Doc/tutorial/classes.rst | |
parent | 28c7bcf38e1e69a9091cbba90b982331428ddbe6 (diff) | |
download | cpython-b19be571e09263239ef29c92eee06dbb30186685.zip cpython-b19be571e09263239ef29c92eee06dbb30186685.tar.gz cpython-b19be571e09263239ef29c92eee06dbb30186685.tar.bz2 |
Some cleanup in the docs.
Diffstat (limited to 'Doc/tutorial/classes.rst')
-rw-r--r-- | Doc/tutorial/classes.rst | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index e4e8451..7761095 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -341,7 +341,7 @@ is called with this new argument list. 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 @@ Derived classes may override methods of their base classes. Because methods 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 @@ instance, if you have a function that formats some data from a file object, you 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 |