per page, with , order by , clip by
Results of 1 - 1 of about 1 for CustomObject (0.002 sec.)
2. 拡張の型の定義: チュートリアル 9414
2. 拡張の型の定義: チュートリアル Python では、組み込みの str 型や list 型のような Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できます。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に理解しておくべ ... #define PY_SSIZE_T_CLEAN #include <Python.h> typedef struct { PyObject_HEAD /* 型固有のフィールドをここに記述します。 */ } CustomObject ; static PyTypeObject CustomType = { . ob_base = PyVarObject_HEAD_INIT ( NULL , 0 ) . tp_name = "custom.Custom" , . tp_doc ... = PyDoc_STR ( "Custom オブジェクト" ), . tp_basicsize = sizeof ( CustomObject ), . tp_itemsize = 0 , . tp_flags = Py_TPFLAGS_DEFAULT , . tp_new = PyType_GenericNew , }; static int custom_module_exec ( ... たことのある部分もあるでしょう。 このファイルでは、次の三つを定義しています。 Custom オブジェクト が何を含んでいるか: これが CustomObject 構造体で、 Custom インスタンスごとに1回だけメモリ確保が行われます。 Custom 型 がどのように振る舞うか: これが CustomType 構 ...
https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html
PREV 1 NEXT