Kill references to tp_print.
This commit is contained in:
parent
346f1a82bd
commit
c77e24b233
|
@ -1151,23 +1151,16 @@ my_dealloc(PyObject *obj)
|
||||||
|
|
||||||
\subsection{Object Presentation}
|
\subsection{Object Presentation}
|
||||||
|
|
||||||
In Python, there are three ways to generate a textual representation
|
In Python, there are two ways to generate a textual representation
|
||||||
of an object: the \function{repr()}\bifuncindex{repr} function (or
|
of an object: the \function{repr()}\bifuncindex{repr} function, and
|
||||||
equivalent back-tick syntax), the \function{str()}\bifuncindex{str}
|
the \function{str()}\bifuncindex{str} function. (The
|
||||||
function, and the \keyword{print} statement. For most objects, the
|
\keyword{print} function just calls \function{str()}.)
|
||||||
\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.
|
|
||||||
|
|
||||||
These handlers are all optional, and most types at most need to
|
These handlers are both optional.
|
||||||
implement the \member{tp_str} and \member{tp_repr} handlers.
|
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
reprfunc tp_repr;
|
reprfunc tp_repr;
|
||||||
reprfunc tp_str;
|
reprfunc tp_str;
|
||||||
printfunc tp_print;
|
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
The \member{tp_repr} handler should return a string object containing
|
The \member{tp_repr} handler should return a string object containing
|
||||||
|
@ -1750,7 +1743,7 @@ In order to learn how to implement any specific method for your new
|
||||||
data type, do the following: Download and unpack the Python source
|
data type, do the following: Download and unpack the Python source
|
||||||
distribution. Go the \file{Objects} directory, then search the
|
distribution. Go the \file{Objects} directory, then search the
|
||||||
C source files for \code{tp_} plus the function you want (for
|
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.
|
examples of the function you want to implement.
|
||||||
|
|
||||||
When you need to verify that an object is an instance of the type
|
When you need to verify that an object is an instance of the type
|
||||||
|
|
Loading…
Reference in New Issue