]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport relevant bits of the bool api docs
authorSkip Montanaro <skip@pobox.com>
Thu, 29 Jul 2004 02:29:24 +0000 (02:29 +0000)
committerSkip Montanaro <skip@pobox.com>
Thu, 29 Jul 2004 02:29:24 +0000 (02:29 +0000)
Doc/api/concrete.tex

index 0d58b59003e2ce046c8fa9bde58b0b4e842f8719..38e570a7f00ce8c654f9dd17a1a5677111ec71e1 100644 (file)
@@ -189,6 +189,39 @@ There is no \cfunction{PyNone_Check()} function for the same reason.
 \end{cfuncdesc}
 
 
+\subsubsection{Boolean Objects \label{boolObjects}}
+
+Booleans in Python are implemented as a subclass of integers.  There
+are only two booleans, \constant{Py_False} and \constant{Py_True}.  As
+such, the normal creation and deletion functions don't apply to
+booleans.  The following macros are available, however.
+
+\begin{cfuncdesc}{int}{PyBool_Check}{PyObject* o}
+  Returns true if \var{o} is of type \cdata{PyBool_Type}.
+  \versionadded{2.3}
+\end{cfuncdesc}
+
+\begin{cvardesc}{PyObject*}{Py_False}
+  The Python \code{False} object.  This object has no methods.  It needs to
+  be treated just like any other object with respect to reference counts.
+\end{cvardesc}
+
+\begin{cvardesc}{PyObject*}{Py_True}
+  The Python \code{True} object.  This object has no methods.  It needs to
+  be treated just like any other object with respect to reference counts.
+\end{cvardesc}
+
+\begin{cfuncdesc}{int}{PyBool_Check}{PyObject* o}
+  Returns true if \var{o} is of type \cdata{PyBool_Type}.
+  \versionadded{2.3}
+\end{cfuncdesc}
+
+\begin{cfuncdesc}{int}{PyBool_FromLong}{long v}
+Returns \constant{Py_True} or \constant{Py_False} depending on the
+truth value of \var{v}.
+\versionadded{2.3}
+\end{cfuncdesc}
+
 \subsection{Long Integer Objects \label{longObjects}}
 
 \obindex{long integer}