Pelokalan
Python ID
id en
Masuk
Proyek
c-api__slice.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
Retrieve the start, stop and step indices from the slice object *slice*, assuming a sequence of length *length*. Treats indices greater than *length* as errors.
Mengambil indeks start, stop, dan step dari objek slice *slice*, dengan asumsi urutan sepanjang *length*. Indeks yang lebih besar dari *length* diperlakukan sebagai kesalahan.
Usable replacement for :c:func:`PySlice_GetIndices`. Retrieve the start, stop, and step indices from the slice object *slice* assuming a sequence of length *length*, and store the length of the slice in *slicelength*. Out of bounds indices are clipped in a manner consistent with the handling of normal slices. *length* must not be negative.
Pengganti yang dapat digunakan untuk :c:func:`PySlice_GetIndices`. Mengambil indeks start, stop, dan step dari objek slice *slice* dengan asumsi urutan sepanjang *length*, dan menyimpan panjang slice dalam *slicelength*. Indeks di luar batas dipotong dengan cara yang konsisten dengan penanganan slice normal. *length* tidak boleh negatif.
if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) < 0) { // return error }
if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) < 0) { // return error }
if (PySlice_Unpack(slice, &start, &stop, &step) < 0) { // return error } slicelength = PySlice_AdjustIndices(length, &start, &stop, step);
if (PySlice_Unpack(slice, &start, &stop, &step) < 0) { // return error } slicelength = PySlice_AdjustIndices(length, &start, &stop, step);
Adjust start/end slice indices assuming a sequence of the specified length. Out of bounds indices are clipped in a manner consistent with the handling of normal slices.
Menyesuaikan indeks slice start/end dengan asumsi urutan sepanjang yang ditentukan. Indeks di luar batas dipotong dengan cara yang konsisten dengan penanganan slice normal.
*length* must not be negative. *step* must not be zero and must not be less than ``-PY_SSIZE_T_MAX``, as guaranteed by :c:func:`PySlice_Unpack`.
*length* tidak boleh negatif. *step* tidak boleh nol dan tidak boleh kurang dari ``-PY_SSIZE_T_MAX``, sebagaimana dijamin oleh :c:func:`PySlice_Unpack`.
Return the length of the slice. Always successful. Doesn't call Python code.
Mengembalikan panjang slice. Selalu berhasil. Tidak memanggil kode Python.