Pelokalan
Python ID
id en
Masuk
Proyek
c-api__arg.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
It requires three arguments. The first is only used as input, and must be a :c:expr:`const char*` which points to the name of an encoding as a NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used. An exception is raised if the named encoding is not known to Python. The second argument must be a :c:expr:`char**`; the value of the pointer it references will be set to a buffer with the contents of the argument text. The text will be encoded in the encoding specified by the first argument. The third argument must be a pointer to an integer; the referenced integer will be set to the number of bytes in the output buffer.
Ini membutuhkan tiga argumen. Yang pertama hanya digunakan sebagai masukan, dan harus berupa :c:expr:`const char*` yang menunjuk pada nama pengkodean sebagai string yang diakhiri dengan NUL, atau ``NULL``, dalam hal ini pengkodean ``'utf-8'`` yang digunakan. Pengecualian akan muncul jika pengkodean yang disebutkan tidak dikenal oleh Python. Argumen kedua harus berupa :c:expr:`char**`; nilai pointer yang direferensikan akan disetel ke buffer dengan isi teks argumen. Teks akan dikodekan dalam pengkodean yang ditentukan oleh argumen pertama. Argumen ketiga harus berupa penunjuk ke sebuah bilangan bulat; bilangan bulat yang direferensikan akan diset ke jumlah byte dalam buffer keluaran.
Numbers
Angka
These formats allow representing Python numbers or single characters as C numbers. Formats that require :class:`int`, :class:`float` or :class:`complex` can also use the corresponding special methods :meth:`~object.__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to convert the Python object to the required type.
Format-format ini memungkinkan untuk merepresentasikan angka Python atau karakter tunggal sebagai angka C. Format yang memerlukan :class:`int`, :class:`float` atau :class:`complex` juga dapat menggunakan metode khusus :meth:`~object.__index__`, :meth:`~object.__float__` atau :meth:`~object.__complex__` untuk mengonversi objek Python ke jenis yang diperlukan.
Convert a Python floating-point number to a C :c:expr:`float`.
Mengonversi angka floating-point Python ke C :c:expr:`float`.
Convert a Python floating-point number to a C :c:expr:`double`.
Mengonversi angka floating-point Python ke C :c:expr:`double`.
Convert a Python complex number to a C :c:type:`Py_complex` structure.
The object must be a Python sequence (except :class:`str`, :class:`bytes` or :class:`bytearray`) whose length is the number of format units in *items*. The C arguments must correspond to the individual format units in *items*. Format units for sequences may be nested.
Objek harus berupa urutan Python (kecuali :class:`str`, :class:`bytes` atau :class:`bytearray`) yang panjangnya adalah jumlah unit format dalam *items*. Argumen C harus sesuai dengan unit format individual dalam *items*. Unit format untuk urutan mungkin menetap.
Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list rather than a variable number of arguments.
Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a va_list rather than a variable number of arguments.
A simpler form of parameter retrieval which does not use a format string to specify the types of the arguments. Functions which use this method to retrieve their parameters should be declared as :c:macro:`METH_VARARGS` in function or method tables. The tuple containing the actual parameters should be passed as *args*; it must actually be a tuple. The length of the tuple must be at least *min* and no more than *max*; *min* and *max* may be equal. Additional arguments must be passed to the function, each of which should be a pointer to a :c:expr:`PyObject*` variable; these will be filled in with the values from *args*; they will contain :term:`borrowed references <borrowed reference>`. The variables which correspond to optional parameters not given by *args* will not be filled in; these should be initialized by the caller. This function returns true on success and false if *args* is not a tuple or contains the wrong number of elements; an exception will be set if there was a failure.
Bentuk pengambilan parameter yang lebih sederhana yang tidak menggunakan string format untuk menentukan jenis argumen. Fungsi yang menggunakan metode ini untuk mengambil parameter harus dideklarasikan sebagai :c:macro:`METH_VARARGS` dalam tabel fungsi atau metode. Tuple yang berisi parameter aktual harus diberikan sebagai * args*; harus benar-benar sebuah tuple. Panjang tuple harus setidaknya *min* dan tidak lebih dari *max*; nilsi *min* dan *max* boleh sama. Argumen tambahan harus dilewatkan ke fungsi, yang masing-masing harus berupa penunjuk ke variabel :c:expr:`PyObject*`; ini akan diisi dengan nilai dari *args*; mereka akan berisi :term: `referensi yang dipinjam <borrowed reference>`. Variabel-variabel yang berhubungan dengan parameter opsional yang tidak diberikan oleh *args* tidak akan diisi; variabel-variabel ini harus diinisialisasi oleh pemanggil. Fungsi ini mengembalikan nilai true jika berhasil dan false jika *args* bukan sebuah tuple atau berisi jumlah elemen yang salah; sebuah pengecualian akan ditetapkan jika terjadi kegagalan.
Convert a C :c:expr:`double` to a Python floating-point number.
Mengonversi C :c:expr:`double` ke angka floating-point Python.
Convert a C :c:expr:`float` to a Python floating-point number.
Mengonversi C :c:expr:`float` ke angka floating-point Python.
Convert a C :c:type:`Py_complex` structure to a Python complex number.
Convert a sequence of C values to a Python tuple with the same number of items.
Convert a sequence of C values to a Python list with the same number of items.
Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list rather than a variable number of arguments.