Pelokalan
Python ID
id en
Masuk
Proyek
c-api__allocation.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
Initialize a newly allocated object *op* with its type and initial reference. Returns the initialized object. Other fields of the object are not initialized. Despite its name, this function is unrelated to the object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init` slot). Specifically, this function does **not** call the object's :meth:`!__init__` method.
Menginisialisasi objek *op* yang baru dialokasikan dengan tipe dan referensi awalnya. Mengembalikan objek yang telah diinisialisasi. Bidang lain dari objek tidak diinisialisasi. Terlepas dari namanya, fungsi ini tidak terkait dengan metode :meth:`~object.__init__` objek (slot:c:member:`~PyTypeObject.tp_init` ). Secara khusus, fungsi ini tidak **tidak** memanggil metode :meth:`!__init__` objek.
It allocates enough memory for the *TYPE* structure plus *size* (``Py_ssize_t``) fields of the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*.
Ini mengalokasikan cukup memori untuk struktur *TYPE* ditambah bidang *size* (``Py_ssize_t``) dengan ukuran yang diberikan oleh bidang :c:member:`~PyTypeObject.tp_itemsize` dari *typeobj*.
This is useful for implementing objects like tuples, which are able to determine their size at construction time. Embedding the array of fields into the same allocation decreases the number of allocations, improving the memory management efficiency.
Hal ini berguna untuk mengimplementasikan objek seperti tuple, yang dapat menentukan ukurannya pada saat konstruksi. Menanamkan array of fields ke dalam alokasi yang sama akan mengurangi jumlah alokasi, sehingga meningkatkan efisiensi manajemen memori.