diff options
author | Guido van Rossum <guido@python.org> | 2007-08-07 20:01:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-08-07 20:01:32 (GMT) |
commit | c77e24b233c0b1b06de077a252b78cfdc5d7df18 (patch) | |
tree | 6d521f9199cf8ef2573fa659511c3fdf388d41b8 | |
parent | 346f1a82bd525b3053d18a5b130ef2e70d4c1858 (diff) | |
download | cpython-c77e24b233c0b1b06de077a252b78cfdc5d7df18.zip cpython-c77e24b233c0b1b06de077a252b78cfdc5d7df18.tar.gz cpython-c77e24b233c0b1b06de077a252b78cfdc5d7df18.tar.bz2 |
Kill references to tp_print.
-rw-r--r-- | Doc/ext/newtypes.tex | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Doc/ext/newtypes.tex b/Doc/ext/newtypes.tex index 5c1f0ae..feed54d 100644 --- a/Doc/ext/newtypes.tex +++ b/Doc/ext/newtypes.tex @@ -1151,23 +1151,16 @@ my_dealloc(PyObject *obj) \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 @@ In order to learn how to implement any specific method for your new 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 |