Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33ee76a

Browse files
author
Skip Montanaro
committed
A little boolean music if you please, maestro... (Not sure I have the
versionadded{} args quite right).
1 parent efdc16f commit 33ee76a

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Doc/api/concrete.tex

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,40 @@ \subsection{Plain Integer Objects \label{intObjects}}
192192
header files).
193193
\end{cfuncdesc}
194194

195+
\subsubsection{Boolean Objects \label{boolObjects}}
196+
197+
Booleans in Python are implemented as a subclass of integers. There
198+
are only two booleans, \constant{Py_False} and \constant{Py_True}. As
199+
such, the normal creation and deletion functions don't apply to
200+
booleans. The following macros are available, however.
201+
202+
\begin{cfuncdesc}{int}{PyBool_Check}{PyObject* o}
203+
Returns true if \var{o} is of type \cdata{PyBool_Type}.
204+
\versionadded{2.3}
205+
\end{cfuncdesc}
206+
207+
\begin{cfuncdesc}{Py_RETURN_FALSE}
208+
Return Py_False from a function, properly incrementing its reference
209+
count.
210+
\versionadded{2.4}
211+
\end{cfuncdesc}
212+
213+
\begin{cfuncdesc}{Py_RETURN_TRUE}
214+
Return Py_True from a function, properly incrementing its reference
215+
count.
216+
\versionadded{2.4}
217+
\end{cfuncdesc}
218+
219+
\begin{cfuncdesc}{int}{PyBool_Check}{PyObject* o}
220+
Returns true if \var{o} is of type \cdata{PyBool_Type}.
221+
\versionadded{2.3}
222+
\end{cfuncdesc}
223+
224+
\begin{cfuncdesc}{int}{PyBool_FromLong}{long v}
225+
Returns \constant{Py_True} or \constant{Py_False} depending on the
226+
truth value of \var{v}.
227+
\versionadded{2.3}
228+
\end{cfuncdesc}
195229

196230
\subsection{Long Integer Objects \label{longObjects}}
197231

0 commit comments

Comments
 (0)