summaryrefslogtreecommitdiffstats
path: root/Doc/ref3.tex
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-11-05 14:45:11 (GMT)
committerGuido van Rossum <guido@python.org>1993-11-05 14:45:11 (GMT)
commit7a2dba2a00cee7e3dff61849e9111073684b6ab7 (patch)
tree0ec359ce267efc71e03a438e8dfbb7e85b9f6afb /Doc/ref3.tex
parentc60041175547df61e67ff167bd5ad18f7967795d (diff)
downloadcpython-7a2dba2a00cee7e3dff61849e9111073684b6ab7.zip
cpython-7a2dba2a00cee7e3dff61849e9111073684b6ab7.tar.gz
cpython-7a2dba2a00cee7e3dff61849e9111073684b6ab7.tar.bz2
* ext.tex: documentation for extending, reference counts, and embedding
(formerly ../misc/{EXTENDING,REFCNT,EMBEDDING}). Also affects Makefile. * text2latex.py: script to do part of the conversion from an plain ASCI text file (in my particular style) to LaTeX. (Chapter/section/subsection headers, and verbatim sections.) * partparse.py, texipre.dat, fix.el, Makefile: Minor cleanup of latex -> info conversion process (at least it works again, and with less debugging output). Removed fix.sh. * lib1.tex (section{Built-in Functions}): adapt description of str() and repr() to new situation. * lib3.tex (Module os): added exec*() variants. * lib3.tex (Module posix): added execve(). * lib2.tex (Module array): documented reality; remove typecode and itemsize, add byteswap, rename read/write to fromfile/tofile, and re-alphabetized. * lib1.tex (Built-in Functions): renamed bagof() to filter().
Diffstat (limited to 'Doc/ref3.tex')
-rw-r--r--Doc/ref3.tex12
1 files changed, 9 insertions, 3 deletions
diff --git a/Doc/ref3.tex b/Doc/ref3.tex
index 855dc82..41ce234 100644
--- a/Doc/ref3.tex
+++ b/Doc/ref3.tex
@@ -583,10 +583,12 @@ class, then \verb\x[i]\ is equivalent to \verb\x.__getitem__(i)\.
(The reverse is not true --- if \verb\x\ is a list object,
\verb\x.__getitem__(i)\ is not equivalent to \verb\x[i]\.)
-Except for \verb\__repr__\ and \verb\__cmp__\, attempts to execute an
+Except for \verb\__repr__\, \verb\__str__\ and \verb\__cmp__\,
+attempts to execute an
operation raise an exception when no appropriate method is defined.
For \verb\__repr__\ and \verb\__cmp__\, the traditional
interpretations are used in this case.
+For \verb\__str__\, the \verb\__repr__\ method is used.
\subsection{Special methods for any type}
@@ -612,8 +614,12 @@ reference is deleted. Also note that it is not guaranteed that
the interpreter exits.
\item[\tt __repr__(self)]
-Called by the \verb\print\ statement and conversions (reverse quotes) to
-compute the string representation of an object.
+Called by the \verb\repr()\ built-in function and by conversions
+(reverse quotes) to compute the string representation of an object.
+
+\item[\tt __str__(self)]
+Called by the \verb\str()\ built-in function and by the \verb\print\
+statement compute the string representation of an object.
\item[\tt __cmp__(self, other)]
Called by all comparison operations. Should return -1 if