[Python-3000-checkins] r56806 - python/branches/py3k-struni/Doc/ext/newtypes.tex
guido.van.rossum
python-3000-checkins at python.org
Tue Aug 7 22:01:33 CEST 2007
Author: guido.van.rossum
Date: Tue Aug 7 22:01:32 2007
New Revision: 56806
Modified:
python/branches/py3k-struni/Doc/ext/newtypes.tex
Log:
Kill references to tp_print.
Modified: python/branches/py3k-struni/Doc/ext/newtypes.tex
==============================================================================
--- python/branches/py3k-struni/Doc/ext/newtypes.tex (original)
+++ python/branches/py3k-struni/Doc/ext/newtypes.tex Tue Aug 7 22:01:32 2007
@@ -1151,23 +1151,16 @@
\subsection{Object Presentation}
-In Python, there are three ways to generate a textual representation
-of an object: the \function{repr()}\bifuncindex{repr} function (or
-equivalent back-tick syntax), the \function{str()}\bifuncindex{str}
-function, and the \keyword{print} statement. For most objects, the
-\keyword{print} statement is equivalent to the \function{str()}
-function, but it is possible to special-case printing to a
-\ctype{FILE*} if necessary; this should only be done if efficiency is
-identified as a problem and profiling suggests that creating a
-temporary string object to be written to a file is too expensive.
+In Python, there are two ways to generate a textual representation
+of an object: the \function{repr()}\bifuncindex{repr} function, and
+the \function{str()}\bifuncindex{str} function. (The
+\keyword{print} function just calls \function{str()}.)
-These handlers are all optional, and most types at most need to
-implement the \member{tp_str} and \member{tp_repr} handlers.
+These handlers are both optional.
\begin{verbatim}
reprfunc tp_repr;
reprfunc tp_str;
- printfunc tp_print;
\end{verbatim}
The \member{tp_repr} handler should return a string object containing
@@ -1750,7 +1743,7 @@
data type, do the following: Download and unpack the Python source
distribution. Go the \file{Objects} directory, then search the
C source files for \code{tp_} plus the function you want (for
-example, \code{tp_print} or \code{tp_compare}). You will find
+example, \code{tp_compare}). You will find
examples of the function you want to implement.
When you need to verify that an object is an instance of the type
More information about the Python-3000-checkins
mailing list