summaryrefslogtreecommitdiff
path: root/devdocs/python~3.12/c-api%2Flist.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/python~3.12/c-api%2Flist.html')
-rw-r--r--devdocs/python~3.12/c-api%2Flist.html60
1 files changed, 60 insertions, 0 deletions
diff --git a/devdocs/python~3.12/c-api%2Flist.html b/devdocs/python~3.12/c-api%2Flist.html
new file mode 100644
index 00000000..5d15a3f5
--- /dev/null
+++ b/devdocs/python~3.12/c-api%2Flist.html
@@ -0,0 +1,60 @@
+ <span id="listobjects"></span><h1>List Objects</h1> <span class="target" id="index-0"></span><dl class="c type"> <dt class="sig sig-object c" id="c.PyListObject">
+<code>type PyListObject</code> </dt> <dd>
+<p>This subtype of <a class="reference internal" href="structures#c.PyObject" title="PyObject"><code>PyObject</code></a> represents a Python list object.</p> </dd>
+</dl> <dl class="c var"> <dt class="sig sig-object c" id="c.PyList_Type">
+<code>PyTypeObject PyList_Type</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>This instance of <a class="reference internal" href="type#c.PyTypeObject" title="PyTypeObject"><code>PyTypeObject</code></a> represents the Python list type. This is the same object as <a class="reference internal" href="../library/stdtypes#list" title="list"><code>list</code></a> in the Python layer.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_Check">
+<code>int PyList_Check(PyObject *p)</code> </dt> <dd>
+<p>Return true if <em>p</em> is a list object or an instance of a subtype of the list type. This function always succeeds.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_CheckExact">
+<code>int PyList_CheckExact(PyObject *p)</code> </dt> <dd>
+<p>Return true if <em>p</em> is a list object, but not an instance of a subtype of the list type. This function always succeeds.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_New">
+<code>PyObject *PyList_New(Py_ssize_t len)</code> </dt> <dd>
+<em class="refcount">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Return a new list of length <em>len</em> on success, or <code>NULL</code> on failure.</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p>If <em>len</em> is greater than zero, the returned list object’s items are set to <code>NULL</code>. Thus you cannot use abstract API functions such as <a class="reference internal" href="sequence#c.PySequence_SetItem" title="PySequence_SetItem"><code>PySequence_SetItem()</code></a> or expose the object to Python code before setting all items to a real object with <a class="reference internal" href="#c.PyList_SetItem" title="PyList_SetItem"><code>PyList_SetItem()</code></a>.</p> </div> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_Size">
+<code>Py_ssize_t PyList_Size(PyObject *list)</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p id="index-1">Return the length of the list object in <em>list</em>; this is equivalent to <code>len(list)</code> on a list object.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_GET_SIZE">
+<code>Py_ssize_t PyList_GET_SIZE(PyObject *list)</code> </dt> <dd>
+<p>Similar to <a class="reference internal" href="#c.PyList_Size" title="PyList_Size"><code>PyList_Size()</code></a>, but without error checking.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_GetItem">
+<code>PyObject *PyList_GetItem(PyObject *list, Py_ssize_t index)</code> </dt> <dd>
+<em class="refcount">Return value: Borrowed reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Return the object at position <em>index</em> in the list pointed to by <em>list</em>. The position must be non-negative; indexing from the end of the list is not supported. If <em>index</em> is out of bounds (&lt;0 or &gt;=len(list)), return <code>NULL</code> and set an <a class="reference internal" href="../library/exceptions#IndexError" title="IndexError"><code>IndexError</code></a> exception.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_GET_ITEM">
+<code>PyObject *PyList_GET_ITEM(PyObject *list, Py_ssize_t i)</code> </dt> <dd>
+<em class="refcount">Return value: Borrowed reference.</em><p>Similar to <a class="reference internal" href="#c.PyList_GetItem" title="PyList_GetItem"><code>PyList_GetItem()</code></a>, but without error checking.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_SetItem">
+<code>int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item)</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Set the item at index <em>index</em> in list to <em>item</em>. Return <code>0</code> on success. If <em>index</em> is out of bounds, return <code>-1</code> and set an <a class="reference internal" href="../library/exceptions#IndexError" title="IndexError"><code>IndexError</code></a> exception.</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p>This function “steals” a reference to <em>item</em> and discards a reference to an item already in the list at the affected position.</p> </div> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_SET_ITEM">
+<code>void PyList_SET_ITEM(PyObject *list, Py_ssize_t i, PyObject *o)</code> </dt> <dd>
+<p>Macro form of <a class="reference internal" href="#c.PyList_SetItem" title="PyList_SetItem"><code>PyList_SetItem()</code></a> without error checking. This is normally only used to fill in new lists where there is no previous content.</p> <div class="admonition note"> <p class="admonition-title">Note</p> <p>This macro “steals” a reference to <em>item</em>, and, unlike <a class="reference internal" href="#c.PyList_SetItem" title="PyList_SetItem"><code>PyList_SetItem()</code></a>, does <em>not</em> discard a reference to any item that is being replaced; any reference in <em>list</em> at position <em>i</em> will be leaked.</p> </div> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_Insert">
+<code>int PyList_Insert(PyObject *list, Py_ssize_t index, PyObject *item)</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Insert the item <em>item</em> into list <em>list</em> in front of index <em>index</em>. Return <code>0</code> if successful; return <code>-1</code> and set an exception if unsuccessful. Analogous to <code>list.insert(index, item)</code>.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_Append">
+<code>int PyList_Append(PyObject *list, PyObject *item)</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Append the object <em>item</em> at the end of list <em>list</em>. Return <code>0</code> if successful; return <code>-1</code> and set an exception if unsuccessful. Analogous to <code>list.append(item)</code>.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_GetSlice">
+<code>PyObject *PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high)</code> </dt> <dd>
+<em class="refcount">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Return a list of the objects in <em>list</em> containing the objects <em>between</em> <em>low</em> and <em>high</em>. Return <code>NULL</code> and set an exception if unsuccessful. Analogous to <code>list[low:high]</code>. Indexing from the end of the list is not supported.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_SetSlice">
+<code>int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist)</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Set the slice of <em>list</em> between <em>low</em> and <em>high</em> to the contents of <em>itemlist</em>. Analogous to <code>list[low:high] = itemlist</code>. The <em>itemlist</em> may be <code>NULL</code>, indicating the assignment of an empty list (slice deletion). Return <code>0</code> on success, <code>-1</code> on failure. Indexing from the end of the list is not supported.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_Sort">
+<code>int PyList_Sort(PyObject *list)</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Sort the items of <em>list</em> in place. Return <code>0</code> on success, <code>-1</code> on failure. This is equivalent to <code>list.sort()</code>.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_Reverse">
+<code>int PyList_Reverse(PyObject *list)</code> </dt> <dd>
+<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p>Reverse the items of <em>list</em> in place. Return <code>0</code> on success, <code>-1</code> on failure. This is the equivalent of <code>list.reverse()</code>.</p> </dd>
+</dl> <dl class="c function"> <dt class="sig sig-object c" id="c.PyList_AsTuple">
+<code>PyObject *PyList_AsTuple(PyObject *list)</code> </dt> <dd>
+<em class="refcount">Return value: New reference.</em><em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a>.</em><p id="index-2">Return a new tuple object containing the contents of <em>list</em>; equivalent to <code>tuple(list)</code>.</p> </dd>
+</dl> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2001&ndash;2023 Python Software Foundation<br>Licensed under the PSF License.<br>
+ <a href="https://docs.python.org/3.12/c-api/list.html" class="_attribution-link">https://docs.python.org/3.12/c-api/list.html</a>
+ </p>
+</div>