Pelokalan
Python ID
id en
Masuk
Proyek
c-api__list.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
List Objects
This subtype of :c:type:`PyObject` represents a Python list object.
This instance of :c:type:`PyTypeObject` represents the Python list type. This is the same object as :class:`list` in the Python layer.
Return true if *p* is a list object or an instance of a subtype of the list type. This function always succeeds.
Return true if *p* is a list object, but not an instance of a subtype of the list type. This function always succeeds.
If *len* is greater than zero, the returned list object's items are set to ``NULL``. Thus you cannot use abstract API functions such as :c:func:`PySequence_SetItem` or expose the object to Python code before setting all items to a real object with :c:func:`PyList_SetItem` or :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is fully initialized: :c:func:`PyList_SetItem()` and :c:func:`PyList_SET_ITEM()`.
Return the length of the list object in *list*; this is equivalent to ``len(list)`` on a list object.
Return the object at position *index* in the list pointed to by *list*. The position must be non-negative; indexing from the end of the list is not supported. If *index* is out of bounds (:code:`<0 or >=len(list)`), return ``NULL`` and set an :exc:`IndexError` exception.
In the :term:`free-threaded build`, this macro has no internal synchronization. It is normally only used to fill in new lists where no other thread has a reference to the list. If the list may be shared, use :c:func:`PyList_SetItem` instead, which uses a :term:`per-object lock`.
Append the object *item* at the end of list *list*. Return ``0`` if successful; return ``-1`` and set an exception if unsuccessful. Analogous to ``list.append(item)``.
Return a list of the objects in *list* containing the objects *between* *low* and *high*. Return ``NULL`` and set an exception if unsuccessful. Analogous to ``list[low:high]``. Indexing from the end of the list is not supported.
Raise an exception and return ``-1`` if *list* is not a :class:`list` object. Return 0 on success.
Raise an exception and return ``-1`` if *list* is not a :class:`list` object. Return 0 on success.
In the :term:`free-threaded build`, element comparison via :meth:`~object.__lt__` can execute arbitrary Python code, during which the :term:`per-object lock` may be temporarily released. For built-in types (:class:`str`, :class:`int`, :class:`float`), the lock is not released during comparison.
Return a new tuple object containing the contents of *list*; equivalent to ``tuple(list)``.
object
objek