o
provides numeric protocols, and
false otherwise.
This function always succeeds.
o1
and o2
, or null on failure.
This is the equivalent of the Python expression: o1+o2
.
o2
from o1
, or null on
failure. This is the equivalent of the Python expression:
o1-o2
.
o1
and o2
, or null on
failure. This is the equivalent of the Python expression:
o1*o2
.
o1
by o2
, or null on failure.
This is the equivalent of the Python expression: o1/o2
.
o1
by o2
, or null on
failure. This is the equivalent of the Python expression:
o1%o2
.
NULL
on failure.
This is the equivalent of the Python expression:
divmod(o1,o2)
.
NULL
on failure.
This is the equivalent of the Python expression:
pow(o1,o2,o3)
, where o3
is optional.
o
on success, or null on failure.
This is the equivalent of the Python expression: -o
.
o
on success, or NULL
on failure.
This is the equivalent of the Python expression: +o
.
o
, or null on failure. This is
the equivalent of the Python expression: abs(o)
.
o
on success, or NULL
on
failure. This is the equivalent of the Python expression:
o
.
o1
by o2
on success, or
NULL
on failure. This is the equivalent of the Python
expression: o1 << o2
.
o1
by o2
on success, or
NULL
on failure. This is the equivalent of the Python
expression: o1 >> o2
.
o2
and o2
on success and NULL
on failure. This is the equivalent of the Python
expression: o1 and o2
.
o1
by o2
on success, or
NULL
on failure. This is the equivalent of the Python
expression: o1^ o2
.
o1
and o2
on success, or NULL
on
failure. This is the equivalent of the Python expression:
o1 or o2
.
PyObject*
.
If the objects pointed to by *p1
and *p2
have the same type,
increment their reference count and return 0 (success).
If the objects can be converted to a common numeric type,
replace *p1
and *p2
by their converted value (with 'new'
reference counts), and return 0.
If no conversion is possible, or if some other error occurs,
return -1 (failure) and don't increment the reference counts.
The call PyNumber_Coerce(&o1, &o2)
is equivalent to the Python
statement o1, o2 = coerce(o1, o2)
.
o
converted to an integer object on success, or
NULL
on failure. This is the equivalent of the Python
expression: int(o)
.
o
converted to a long integer object on success,
or NULL
on failure. This is the equivalent of the Python
expression: long(o)
.
o
converted to a float object on success, or NULL
on failure. This is the equivalent of the Python expression:
float(o)
.