From 7a2dba2a00cee7e3dff61849e9111073684b6ab7 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 5 Nov 1993 14:45:11 +0000 Subject: * 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(). --- Doc/ref3.tex | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Doc/ref3.tex') diff --git a/Doc/ref3.tex b/Doc/ref3.tex index 855dc826d2..41ce23426e 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 -- cgit v1.2.1