A PyTupleObject is the C version of a Python tuple; it has the type PyTuple_Type, which is the same as Python's types.TupleType. Call PyTuple_Check(PyObject *o) to determine whether an object is a tuple.

PyTuple_New(int len) returns a new reference to a tuple object of length len. PyTuple_Resize(PyObject *o, int newsize, 0) resizes a given tuple; as with the list resize function, it is safe to call only if no other references to this object exist. This function returns 0 on success.

Table 30-5 lists the C function calls for common tuple operations.

Table 30-5 C Tuple Functions


Equivalent C Function Call

0 0

Post a comment