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

Skip to content

Commit 7740a01

Browse files
committed
Thomas Wouters <[email protected]>:
Fix up some of the PyNumber_*() documentation. Add documentation for the InPlace API calls.
1 parent 9c940ca commit 7740a01

1 file changed

Lines changed: 106 additions & 7 deletions

File tree

Doc/api/api.tex

Lines changed: 106 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,22 +1625,107 @@ \section{Number Protocol \label{number}}
16251625

16261626

16271627
\begin{cfuncdesc}{PyObject*}{PyNumber_And}{PyObject *o1, PyObject *o2}
1628-
Returns the result of ``anding'' \var{o2} and \var{o2} on success and
1629-
\NULL{} on failure. This is the equivalent of the Python
1630-
expression \samp{\var{o1} and \var{o2}}.
1628+
Returns the ``bitwise and'' of \var{o2} and \var{o2} on success and
1629+
\NULL{} on failure. This is the equivalent of the Python expression
1630+
\samp{\var{o1} \& \var{o2}}.
16311631
\end{cfuncdesc}
16321632

16331633

16341634
\begin{cfuncdesc}{PyObject*}{PyNumber_Xor}{PyObject *o1, PyObject *o2}
1635-
Returns the bitwise exclusive or of \var{o1} by \var{o2} on success,
1635+
Returns the ``bitwise exclusive or'' of \var{o1} by \var{o2} on success,
16361636
or \NULL{} on failure. This is the equivalent of the Python
16371637
expression \samp{\var{o1} \^{ }\var{o2}}.
16381638
\end{cfuncdesc}
16391639

16401640
\begin{cfuncdesc}{PyObject*}{PyNumber_Or}{PyObject *o1, PyObject *o2}
1641-
Returns the result of \var{o1} and \var{o2} on success, or \NULL{} on
1642-
failure. This is the equivalent of the Python expression
1643-
\samp{\var{o1} or \var{o2}}.
1641+
Returns the ``bitwise or'' of \var{o1} and \var{o2} on success, or
1642+
\NULL{} on failure. This is the equivalent of the Python expression
1643+
\samp{\var{o1} | \var{o2}}.
1644+
\end{cfuncdesc}
1645+
1646+
1647+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceAdd}{PyObject *o1, PyObject *o2}
1648+
Returns the result of adding \var{o1} and \var{o2}, or \NULL{} on failure.
1649+
The operation is done \emph{in-place} when \var{o1} supports it. This is the
1650+
equivalent of the Python expression \samp{\var{o1} += \var{o2}}.
1651+
\end{cfuncdesc}
1652+
1653+
1654+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceSubtract}{PyObject *o1, PyObject *o2}
1655+
Returns the result of subtracting \var{o2} from \var{o1}, or
1656+
\NULL{} on failure. The operation is done \emph{in-place} when \var{o1}
1657+
supports it. This is the equivalent of the Python expression \samp{\var{o1}
1658+
-= \var{o2}}.
1659+
\end{cfuncdesc}
1660+
1661+
1662+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceMultiply}{PyObject *o1, PyObject *o2}
1663+
Returns the result of multiplying \var{o1} and \var{o2}, or \NULL{} on
1664+
failure. The operation is done \emph{in-place} when \var{o1} supports it.
1665+
This is the equivalent of the Python expression \samp{\var{o1} *= \var{o2}}.
1666+
\end{cfuncdesc}
1667+
1668+
1669+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceDivide}{PyObject *o1, PyObject *o2}
1670+
Returns the result of dividing \var{o1} by \var{o2}, or \NULL{} on failure.
1671+
The operation is done \emph{in-place} when \var{o1} supports it. This is the
1672+
equivalent of the Python expression \samp{\var{o1} /= \var{o2}}.
1673+
\end{cfuncdesc}
1674+
1675+
1676+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceRemainder}{PyObject *o1, PyObject *o2}
1677+
Returns the remainder of dividing \var{o1} by \var{o2}, or \NULL{} on
1678+
failure. The operation is done \emph{in-place} when \var{o1} supports it.
1679+
This is the equivalent of the Python expression \samp{\var{o1} \%= \var{o2}}.
1680+
\end{cfuncdesc}
1681+
1682+
1683+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlacePower}{PyObject *o1, PyObject *o2, PyObject *o3}
1684+
See the built-in function \function{pow()}\bifuncindex{pow}. Returns
1685+
\NULL{} on failure. The operation is done \emph{in-place} when \var{o1}
1686+
supports it. This is the equivalent of the Python expression \samp{\var{o1}
1687+
**= \var{o2}} when o3 is \cdata{Py_None}, or an in-place variant of
1688+
\samp{pow(\var{o1}, \var{o2}, var{o3})} otherwise. If \var{o3} is to be
1689+
ignored, pass \cdata{Py_None} in its place (passing \NULL{} for \var{o3}
1690+
would cause an illegal memory access).
1691+
\end{cfuncdesc}
1692+
1693+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceLshift}{PyObject *o1, PyObject *o2}
1694+
Returns the result of left shifting \var{o1} by \var{o2} on success, or
1695+
\NULL{} on failure. The operation is done \emph{in-place} when \var{o1}
1696+
supports it. This is the equivalent of the Python expression \samp{\var{o1}
1697+
<<= \var{o2}}.
1698+
\end{cfuncdesc}
1699+
1700+
1701+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceRshift}{PyObject *o1, PyObject *o2}
1702+
Returns the result of right shifting \var{o1} by \var{o2} on success, or
1703+
\NULL{} on failure. The operation is done \emph{in-place} when \var{o1}
1704+
supports it. This is the equivalent of the Python expression \samp{\var{o1}
1705+
>>= \var{o2}}.
1706+
\end{cfuncdesc}
1707+
1708+
1709+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceAnd}{PyObject *o1, PyObject *o2}
1710+
Returns the ``bitwise and'' of \var{o2} and \var{o2} on success
1711+
and \NULL{} on failure. The operation is done \emph{in-place} when \var{o1}
1712+
supports it. This is the equivalent of the Python expression \samp{\var{o1}
1713+
\&= \var{o2}}.
1714+
\end{cfuncdesc}
1715+
1716+
1717+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceXor}{PyObject *o1, PyObject *o2}
1718+
Returns the ``bitwise exclusive or'' of \var{o1} by \var{o2} on success, or
1719+
\NULL{} on failure. The operation is done \emph{in-place} when \var{o1}
1720+
supports it. This is the equivalent of the Python expression \samp{\var{o1}
1721+
\^= \var{o2}}.
1722+
\end{cfuncdesc}
1723+
1724+
\begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceOr}{PyObject *o1, PyObject *o2}
1725+
Returns the ``bitwise or'' of \var{o1} and \var{o2} on success, or \NULL{}
1726+
on failure. The operation is done \emph{in-place} when \var{o1} supports
1727+
it. This is the equivalent of the Python expression \samp{\var{o1} |=
1728+
\var{o2}}.
16441729
\end{cfuncdesc}
16451730

16461731
\begin{cfuncdesc}{PyObject*}{PyNumber_Coerce}{PyObject **p1, PyObject **p2}
@@ -1703,6 +1788,20 @@ \section{Sequence Protocol \label{sequence}}
17031788
equivalent of the Python expression \samp{\var{o} * \var{count}}.
17041789
\end{cfuncdesc}
17051790

1791+
\begin{cfuncdesc}{PyObject*}{PySequence_InPlaceConcat}{PyObject *o1, PyObject *o2}
1792+
Return the concatenation of \var{o1} and \var{o2} on success, and \NULL{} on
1793+
failure. The operation is done \emph{in-place} when \var{o1} supports it.
1794+
This is the equivalent of the Python expression \samp{\var{o1} += \var{o2}}.
1795+
\end{cfuncdesc}
1796+
1797+
1798+
\begin{cfuncdesc}{PyObject*}{PySequence_InPlaceRepeat}{PyObject *o, int count}
1799+
Return the result of repeating sequence object \var{o} \var{count} times, or
1800+
\NULL{} on failure. The operation is done \emph{in-place} when \var{o}
1801+
supports it. This is the equivalent of the Python expression \samp{\var{o}
1802+
*= \var{count}}.
1803+
\end{cfuncdesc}
1804+
17061805

17071806
\begin{cfuncdesc}{PyObject*}{PySequence_GetItem}{PyObject *o, int i}
17081807
Return the \var{i}th element of \var{o}, or \NULL{} on failure. This

0 commit comments

Comments
 (0)