序列協定

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

Return 1 if the object provides the sequence protocol, and 0 otherwise. Note that it returns 1 for Python classes with a __getitem__() method, unless they are dict subclasses, since in general it is impossible to determine what type of keys the class supports. This function always succeeds.

Py_ssize_t PySequence_Size(PyObject *o)
Py_ssize_t PySequence_Length(PyObject *o)
穩定 ABI 的一部分.

Returns the number of objects in sequence o on success, and -1 on failure. This is equivalent to the Python expression len(o).

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

Return the concatenation of o1 and o2 on success, and NULL on failure. This is the equivalent of the Python expression o1 + o2.

PyObject *PySequence_Repeat(PyObject *o, Py_ssize_t count)
回傳值:新的參照。穩定 ABI 的一部分.

Return the result of repeating sequence object o count times, or NULL on failure. This is the equivalent of the Python expression o * count.

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

Return the concatenation of o1 and o2 on success, and NULL on failure. The operation is done in-place when o1 supports it. This is the equivalent of the Python expression o1 += o2.

PyObject *PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count)
回傳值:新的參照。穩定 ABI 的一部分.

Return the result of repeating sequence object o count times, or NULL on failure. The operation is done in-place when o supports it. This is the equivalent of the Python expression o *= count.

PyObject *PySequence_GetItem(PyObject *o, Py_ssize_t i)
回傳值:新的參照。穩定 ABI 的一部分.

Return the ith element of o, or NULL on failure. This is the equivalent of the Python expression o[i].

PyObject *PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2)
回傳值:新的參照。穩定 ABI 的一部分.

Return the slice of sequence object o between i1 and i2, or NULL on failure. This is the equivalent of the Python expression o[i1:i2].

int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v)
穩定 ABI 的一部分.

Assign object v to the ith element of o. Raise an exception and return -1 on failure; return 0 on success. This is the equivalent of the Python statement o[i] = v. This function does not steal a reference to v.

If v is NULL, the element is deleted, but this feature is deprecated in favour of using PySequence_DelItem().

int PySequence_DelItem(PyObject *o, Py_ssize_t i)
穩定 ABI 的一部分.

Delete the ith element of object o. Returns -1 on failure. This is the equivalent of the Python statement del o[i].

int PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v)
穩定 ABI 的一部分.

Assign the sequence object v to the slice in sequence object o from i1 to i2. This is the equivalent of the Python statement o[i1:i2] = v.

int PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2)
穩定 ABI 的一部分.

Delete the slice in sequence object o from i1 to i2. Returns -1 on failure. This is the equivalent of the Python statement del o[i1:i2].

Py_ssize_t PySequence_Count(PyObject *o, PyObject *value)
穩定 ABI 的一部分.

Return the number of occurrences of value in o, that is, return the number of keys for which o[key] == value. On failure, return -1. This is equivalent to the Python expression o.count(value).

int PySequence_Contains(PyObject *o, PyObject *value)
穩定 ABI 的一部分.

Determine if o contains value. If an item in o is equal to value, return 1, otherwise return 0. On error, return -1. This is equivalent to the Python expression value in o.

int PySequence_In(PyObject *