PyObject *o, FILE *fp, int flags) |
-1
on
error. The flags argument is used to enable certain printing
options. The only option currently supported is
Py_PRINT_RAW; if given, the str() of the
object is written instead of the repr().
PyObject *o, char *attr_name) |
1
if o has the attribute attr_name, and
0
otherwise. This is equivalent to the Python expression
"hasattr(o, attr_name)". This function always
succeeds.
PyObject *o, char *attr_name) |
PyObject *o, PyObject *attr_name) |
1
if o has the attribute attr_name, and
0
otherwise. This is equivalent to the Python expression
"hasattr(o, attr_name)". This function always
succeeds.
PyObject *o, PyObject *attr_name) |
PyObject *o, char *attr_name, PyObject *v) |
-1
on failure. This
is the equivalent of the Python statement
"o.attr_name = v".
PyObject *o, PyObject *attr_name, PyObject *v) |
-1
on failure. This
is the equivalent of the Python statement
"o.attr_name = v".
PyObject *o, char *attr_name) |
-1
on failure. This is the equivalent of the Python
statement: "del o.attr_name".
PyObject *o, PyObject *attr_name) |
-1
on failure. This is the equivalent of the Python
statement "del o.attr_name".
PyObject *o1, PyObject *o2, int opid) |
<
,
<=
,
==
,
!=
,
>
, or
>=
respectively. This is the equivalent of the Python expression
"o1 op o2", where op
is the operator
corresponding to opid. Returns the value of the comparison on
success, or NULL on failure.
PyObject *o1, PyObject *o2, int opid) |
<
,
<=
,
==
,
!=
,
>
, or
>=
respectively. Returns -1
on error, 0
if the
result is false, 1
otherwise. This is the equivalent of the
Python expression "o1 op o2", where
op
is the operator corresponding to opid.
PyObject *o1, PyObject *o2, int *result) |
-1
on failure. This is the equivalent
of the Python statement "result =
cmp(o1, o2)".
PyObject *o1, PyObject *o2) |
PyObject *o) |
PyObject *o) |
PyObject *o) |
PyObject *inst, PyObject *cls) |
1
if inst is an instance of the class cls
or a subclass of cls, or 0
if not. On error, returns
-1
and sets an exception. If cls is a type object
rather than a class object, PyObject_IsInstance()
returns 1
if inst is of type cls. If cls
is a tuple, the check will be done against every entry in cls.
The result will be 1
when at least one of the checks returns
1
, otherwise it will be 0
. If inst is not a class
instance and cls is neither a type object, nor a class object,
nor a tuple, inst must have a __class__ attribute
-- the class relationship of the value of that attribute with
cls will be used to determine the result of this function.
New in version 2.1.
Changed in version 2.2:
Support for a tuple as the second argument added.
Subclass determination is done in a fairly straightforward way, but includes a wrinkle that implementors of extensions to the class system may want to be aware of. If A and B are class objects, B is a subclass of A if it inherits from A either directly or indirectly. If either is not a class object, a more general mechanism is used to determine the class relationship of the two objects. When testing if B is a subclass of A, if A is B, PyObject_IsSubclass() returns true. If A and B are different objects, B's __bases__ attribute is searched in a depth-first fashion for A -- the presence of the __bases__ attribute is considered sufficient for this determination.
PyObject *derived, PyObject *cls) |
1
if the class derived is identical to or
derived from the class cls, otherwise returns 0
. In
case of an error, returns -1
. If cls
is a tuple, the check will be done against every entry in cls.
The result will be 1
when at least one of the checks returns
1
, otherwise it will be 0
. If either derived or
cls is not an actual class object (or tuple), this function
uses the generic algorithm described above.
New in version 2.1.
Changed in version 2.3:
Older versions of Python did not support a tuple
as the second argument.
PyObject *o) |
1
if the
object is callable and 0
otherwise. This function always
succeeds.
PyObject *callable_object, PyObject *args, PyObject *kw) |
PyObject *callable_object, PyObject *args) |
PyObject *callable, char *format, ...) |
PyObject *o, char *method, char *format, ...) |
PyObject *callable,
...,
NULL ) |
PyObject *o,
PyObject *name,
...,
NULL ) |
PyObject *o) |
-1
. This is the equivalent of the Python expression
"hash(o)".
PyObject *o) |
1
if the object o is considered to be true, and
0
otherwise. This is equivalent to the Python expression
"not not o". On failure, return -1
.
PyObject *o) |
0
if the object o is considered to be true, and
1
otherwise. This is equivalent to the Python expression
"not o". On failure, return -1
.
PyObject *o) |
type(o)
. This function increments the reference count of the return value.
There's really no reason to use this function instead of the
common expression o->ob_type
, which returns a pointer
of type PyTypeObject*, except when the incremented reference
count is needed.
PyObject *o, PyTypeObject *type) |
PyObject *o) |
PyObject *o) |
-1
is returned. This is the equivalent
to the Python expression "len(o)".
PyObject *o, PyObject *key) |
PyObject *o, PyObject *key, PyObject *v) |
-1
on
failure. This is the equivalent of the Python statement
"o[key] = v".
PyObject *o, PyObject *key) |
-1
on
failure. This is the equivalent of the Python statement "del
o[key]".
PyObject *o) |
-1
on failure.
PyObject *o) |
PyObject *o) |
See About this document... for information on suggesting changes.