Lines Matching full:list
5 List Objects
8 .. index:: pair: object; list
13 This subtype of :c:type:`PyObject` represents a Python list object.
18 This instance of :c:type:`PyTypeObject` represents the Python list type.
19 This is the same object as :class:`list` in the Python layer.
24 Return true if *p* is a list object or an instance of a subtype of the list
30 Return true if *p* is a list object, but not an instance of a subtype of
31 the list type. This function always succeeds.
36 Return a new list of length *len* on success, or ``NULL`` on failure.
40 If *len* is greater than zero, the returned list object's items are
45 the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`.
49 .. c:function:: Py_ssize_t PyList_Size(PyObject *list)
53 Return the length of the list object in *list*; this is equivalent to
54 ``len(list)`` on a list object.
57 .. c:function:: Py_ssize_t PyList_GET_SIZE(PyObject *list)
62 .. c:function:: PyObject* PyList_GetItemRef(PyObject *list, Py_ssize_t index)
64 Return the object at position *index* in the list pointed to by *list*. The
65 position must be non-negative; indexing from the end of the list is not
66 supported. If *index* is out of bounds (:code:`<0 or >=len(list)`),
72 .. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
78 .. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)
83 .. c:function:: int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item)
85 Set the item at index *index* in list to *item*. Return ``0`` on success.
92 an item already in the list at the affected position.
95 .. c:function:: void PyList_SET_ITEM(PyObject *list, Py_ssize_t i, PyObject *o)
108 is being replaced; any reference in *list* at position *i* will be
112 .. c:function:: int PyList_Insert(PyObject *list, Py_ssize_t index, PyObject *item)
114 Insert the item *item* into list *list* in front of index *index*. Return
116 Analogous to ``list.insert(index, item)``.
119 .. c:function:: int PyList_Append(PyObject *list, PyObject *item)
121 Append the object *item* at the end of list *list*. Return ``0`` if
123 to ``list.append(item)``.
126 .. c:function:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high)
128 Return a list of the objects in *list* containing the objects *between* *low*
130 to ``list[low:high]``. Indexing from the end of the list is not supported.
133 .. c:function:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *item…
135 Set the slice of *list* between *low* and *high* to the contents of
136 *itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may
137 be ``NULL``, indicating the assignment of an empty list (slice deletion).
139 list is not supported.
142 .. c:function:: int PyList_Extend(PyObject *list, PyObject *iterable)
144 Extend *list* with the contents of *iterable*. This is the same as
145 ``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)``
146 and analogous to ``list.extend(iterable)`` or ``list += iterable``.
148 Raise an exception and return ``-1`` if *list* is not a :class:`list`
154 .. c:function:: int PyList_Clear(PyObject *list)
156 Remove all items from *list*. This is the same as
157 ``PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL)`` and analogous to
158 ``list.clear()`` or ``del list[:]``.
160 Raise an exception and return ``-1`` if *list* is not a :class:`list`
166 .. c:function:: int PyList_Sort(PyObject *list)
168 Sort the items of *list* in place. Return ``0`` on success, ``-1`` on
169 failure. This is equivalent to ``list.sort()``.
172 .. c:function:: int PyList_Reverse(PyObject *list)
174 Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on
175 failure. This is the equivalent of ``list.reverse()``.
178 .. c:function:: PyObject* PyList_AsTuple(PyObject *list)
182 Return a new tuple object containing the contents of *list*; equivalent to
183 ``tuple(list)``.