Sequence Protocol¶
-
int PySequence_Check(PyObject *o)¶
- Part of the Stable ABI.
Return
1if the object provides the sequence protocol, and0otherwise. Note that it returns1for Python classes with a__getitem__()method, unless they aredictsubclasses, 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)¶
- Part of the Stable ABI.
Returns the number of objects in sequence o on success, and
-1on failure. This is equivalent to the Python expressionlen(o).
-
PyObject *PySequence_Concat(PyObject *o1, PyObject *o2)¶
- Return value: New reference. Part of the Stable ABI.
Return the concatenation of o1 and o2 on success, and
NULLon failure. This is the equivalent of the Python expressiono1 + o2.
-
PyObject *PySequence_Repeat(PyObject *o, Py_ssize_t count)¶
- Return value: New reference. Part of the Stable ABI.
Return the result of repeating sequence object o count times, or
NULLon failure. This is the equivalent of the Python expressiono * count.
-
PyObject *PySequence_InPlaceConcat(PyObject *o1, PyObject *o2)¶
- Return value: New reference. Part of the Stable ABI.
Return the concatenation of o1 and o2 on success, and
NULLon failure. The operation is done in-place when o1 supports it. This is the equivalent of the Python expressiono1 += o2.
-
PyObject *PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count)¶
- Return value: New reference. Part of the Stable ABI.
Return the result of repeating sequence object o count times, or
NULLon failure. The operation is done in-place when o supports it. This is the equivalent of the Python expressiono *= count.