數字協定

int PyNumber_Check(PyObject *o)
穩定 ABI 的一部分.

Returns 1 if the object o provides numeric protocols, and false otherwise. This function always succeeds.

在 3.8 版的變更: Returns 1 if o is an index integer.

PyObject *PyNumber_Add(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分.

Returns the result of adding o1 and o2, or NULL on failure. This is the equivalent of the Python expression o1 + o2.

PyObject *PyNumber_Subtract(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分.

Returns the result of subtracting o2 from o1, or NULL on failure. This is the equivalent of the Python expression o1 - o2.

PyObject *PyNumber_Multiply(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分.

Returns the result of multiplying o1 and o2, or NULL on failure. This is the equivalent of the Python expression o1 * o2.

PyObject *PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分 自 3.7 版本開始.

Returns the result of matrix multiplication on o1 and o2, or NULL on failure. This is the equivalent of the Python expression o1 @ o2.

在 3.5 版被加入.

PyObject *PyNumber_FloorDivide(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分.

Return the floor of o1 divided by o2, or NULL on failure. This is the equivalent of the Python expression o1 // o2.

PyObject *PyNumber_TrueDivide(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分.

Return a reasonable approximation for the mathematical value of o1 divided by o2, or NULL on failure. The return value is "approximate" because binary floating-point numbers are approximate; it is not possible to represent all real numbers in base two. This function can return a floating-point value when passed two integers. This is the equivalent of the Python expression o1 / o2.

PyObject *PyNumber_Remainder(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分.

Returns the remainder of dividing o1 by o2, or NULL on failure. This is the equivalent of the Python expression o1 % o2.

PyObject *PyNumber_Divmod(PyObject *o1, PyObject *o2)
回傳值:新的參照。穩定 ABI 的一部分.

See the built-in function divmod(). Returns NULL on failure. This is the equivalent of the Python expression divmod(o1, o2).

PyObject *PyNumber_Power(