per page, with , order by , clip by
Results of 1 - 10 of about 31 for slots (0.007 sec.)
デスクリプタ ガイド 12149
デスクリプタ ガイド Author : Raymond Hettinger Contact : <python at rcn dot com> デスクリプタ を使うと、オブジェクトの属性の検索、保存、削除をカスタマイズできます。 本ガイドは4つの大項目から構成されています。 最初の「入門」では基本の紹介をし ... する処理を、Python だけで実装しています。 関数が束縛メソッドになる仕組みや、 @classmethod 、 @staticmethod 、 @property 、 __slots__ といったよく使う機能の実装に興味があれば、読んでみてください。 入門 この入門では、なるべく基礎的なところから開始し、新し ... 中には、あまりに一般的なので組み込みに追加されたものもあります。プロパティ、束縛のメソッド、静的メソッド、クラスメソッド、 __slots__ は、全てデスクリプタプロトコルに基づいています。 プロパティ property() を呼び出すことで、属性へアクセスすると関数の呼び出 ... ように見えるよう、必要な属性を追加します: __name__ 、 __qualname__ 、 __doc__ 、 __annotations__ 。 メンバーオブジェクトと __slots__ クラスが __slots__ を定義すると、インスタンスの辞書が固定長のスロットの値の配列と置き換えられます。ユーザーの目線からみる ...
https://man.mtool.work/python/3.14/howto/descriptor.html
モジュールオブジェクト (module object) 11502
モジュールオブジェクト (module object) PyTypeObject PyModule_Type 次に属します: Stable ABI . この PyTypeObject のインスタンスは Python のモジュール型を表します。 Python プログラムには types.ModuleType として公開されています。 int PyModule_C ... of module-level functions, described by PyMethodDef values. Can be NULL if no functions are present. PyModuleDef_Slot * m_slots An array of slot definitions for multi-phase initialization, terminated by a {0, NULL} entry. When using legacy single-pha ... se initialization, m_slots must be NULL . バージョン 3.5 で変更: バージョン 3.5 より前は、このメンバは常に NULL に設定されていて、次のものとして定義さ ... d. PyTypeObject PyModuleDef_Type 次に属します: Stable ABI (バージョン 3.5 より). PyModuleDef オブジェクトの型です。 Module slots type PyModuleDef_Slot 次に属します: Stable ABI (すべてのメンバーを含む) (バージョン 3.5 より). int slot A slot ID, chosen ...
https://man.mtool.work/python/3.14/c-api/module.html
2. 拡張の型の定義: チュートリアル 11502
2. 拡張の型の定義: チュートリアル Python では、組み込みの str 型や list 型のような Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できます。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に理解しておくべ ... ef ( m , "Custom" , ( PyObject * ) & CustomType ) < 0 ) { return -1 ; } return 0 ; } static PyModuleDef_Slot custom_module_slots [] = { { Py_mod_exec , custom_module_exec }, // 静的な型を使う間はこの設定を使う { Py_mod_multiple_interpreters , Py_MOD_M ... base = PyModuleDef_HEAD_INIT , . m_name = "custom" , . m_doc = "拡張型を作成するサンプルモジュール。" , . m_size = 0 , . m_slots = custom_module_slots , }; PyMODINIT_FUNC PyInit_custom ( void ) { return PyModuleDef_Init ( & custom_module ); } 一度に理 ... ef ( m , "Custom" , ( PyObject * ) & CustomType ) < 0 ) { return -1 ; } return 0 ; } static PyModuleDef_Slot custom_module_slots [] = { { Py_mod_exec , custom_module_exec }, { Py_mod_multiple_interpreters , Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED } ...
https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html
dataclasses --- データクラス 11502
dataclasses --- データクラス ソースコード: Lib/dataclasses.py このモジュールは、 __init__() や __repr__() のような 特殊メソッド を生成し、ユーザー定義のクラスに自動的に追加するデコレーターや関数を提供します。このモジュールは元々、 PEP 557 で ... e , repr = True , eq = True , order = False , unsafe_hash = False , frozen = False , match_args = True , kw_only = False , slots = False , weakref_slot = False ) この関数は、後述する 特殊メソッド を生成し、クラスに追加する decorator です。 @dataclass ... e , repr = True , eq = True , order = False , unsafe_hash = False , frozen = False , match_args = True , kw_only = False , slots = False , weakref_slot = False ) class C : ... @dataclass のパラメータは以下のとおりです: init : 真の場合 (デフォルト)、 _ ... ださい。 KW_ONLY の節も参照してください。 キーワード専用フィールドは __match_args__ に含まれません。 Added in version 3.10. slots : 真の場合 (デフォルトは False )、 __slots__ 属性を生成し、元のクラスの代わりに新しいクラスを返します。 クラスに __slots__ ...
https://man.mtool.work/python/3.14/library/dataclasses.html
3. データモデル 11502
3. データモデル 3.1. オブジェクト、値、および型 オブジェクト は、Python がデータを抽象化したものです。 Python プログラム内のすべてのデータは、オブジェクトまたはオブジェクト間の関係として表されます。 コードもオブジェクトで表されます。 すべて ... する辞書、またはその他のマッピングオブジェクトです。 すべてのインスタンスが __dict__ 属性を持つわけではありません。 詳細は __slots__ を参照してください。 3.2.12. I/O オブジェクト (ファイルオブジェクトの別名) file object は開かれたファイルを表します。ファ ... データデスクリプタとして実装されています。 そのため、インスタンスではプロパティの動作をオーバーライドできません。 3.3.2.4. __slots__ __slots__ を使うと、(プロパティのように) データメンバを明示的に宣言し、 (明示的に __slots__ で宣言しているか親クラスに存 ... す。 __dict__ を使うのに比べて、節約できるメモリ空間はかなり大きいです。 属性探索のスピードもかなり向上できます。 object. __slots__ このクラス変数には、インスタンスが用いる変数名を表す、文字列、イテラブル、または文字列のシーケンスを代入できます。 __slo ...
https://man.mtool.work/python/3.14/reference/datamodel.html
型オブジェクト 8412
型オブジェクト type PyTypeObject 次に属します: Limited API (不透明な構造体として). 組み込み型を記述する際に用いられる、オブジェクトを表す C 構造体です。 PyTypeObject PyType_Type 次に属します: Stable ABI . 型オブジェクト自身の型オブジェクトで ... sed to construct the resulting type object. When metaclass is NULL , the metaclass is derived from bases (or Py_tp_base[s] slots if bases is NULL , see below). tp_new をオーバーライドするメタクラスは、 tp_new が NULL の場合を除いてサポートされません。 ... ect.tp_flags . If the Py_TPFLAGS_HEAPTYPE flag is not set, PyType_FromSpecWithBases() sets it automatically. PyType_Slot * slots Array of PyType_Slot structures. Terminated by the special slot value {0, NULL} . Each slot ID should be specified at most ... value of the slot. In most cases, this is a pointer to a function. pfunc values may not be NULL , except for the following slots: Py_tp_doc Py_tp_token (明確にするため、 NULL より Py_TP_USE_SPEC を使うことを推奨します) Py_tp_token 次に属します: Stable ...
https://man.mtool.work/python/3.14/c-api/type.html
オブジェクト実装サポート (object implementation support) 8250
オブジェクト実装サポート (object implementation support) この章では、新しいオブジェクトの型を定義する際に使われる関数、型、およびマクロについて説明します。 ヒープ上でのオブジェクトの割り当て 緩やかに非推奨となった別名 オブジェクトのライフサ ... アクセス メンバーのフラグ メンバーの型 ゲッターとセッターの定義 型オブジェクトの構造体 クイックリファレンス tp スロット sub-slots スロットの定義型 (typedef) PyTypeObject 定義 PyObject スロット PyVarObject スロット PyTypeObject スロット 静的な型 ヒープ型 ...
https://man.mtool.work/python/3.14/c-api/objimpl.html
C API 拡張のフリースレッド対応 8250
C API 拡張のフリースレッド対応 CPython 3.13 から、 global interpreter lock (GIL) を無効にして実行する free threading という構成がサポートされています。 このドキュメントでは、C API を使う拡張をフリースレッドに対応させる方法を説明します。 C か ... ts older versions of CPython, you should guard the slot with a PY_VERSION_HEX check. static struct PyModuleDef_Slot module_slots [] = { ... #if PY_VERSION_HEX >= 0x030D0000 { Py_mod_gil , Py_MOD_GIL_NOT_USED }, #endif { 0 , NULL } }; static struct PyM ... oduleDef moduledef = { PyModuleDef_HEAD_INIT , . m_slots = module_slots , ... }; 単一フェーズ初期化 Extensions that use single-phase initialization (i.e., PyModule_Create() ) shou ...
https://man.mtool.work/python/3.14/howto/free-threading-extensions.html
weakref --- 弱参照 7926
weakref --- 弱参照 ソースコード: Lib/weakref.py weakref モジュールを使うと、Python プログラムからオブジェクトへの 弱参照 を作成できます。 以下では、用語リファレント( referent ) は弱参照が参照するオブジェクトを意味します。 オブジェクトへの弱 ... ん。 拡張型は、簡単に弱参照をサポートできます。詳細については、 弱参照(Weak Reference)のサポート を参照してください。 When __slots__ are defined for a given type, weak reference support is disabled unless a '__weakref__' string is also present in the se ... quence of strings in the __slots__ declaration. See __slots__ documentation for details. class weakref. ref ( object [ , callback ] ) object への弱参照を返 ...
https://man.mtool.work/python/3.14/library/weakref.html
What's New in Python 2.2 7926
What's New in Python 2.2 著者 : A.M. Kuchling はじめに この文書は 2002 年 10 月 14 日にリリースされた Python 2.2.2 の新機能について解説します。Python 2.2.2 は 2001 年 12 月 21 日にリリースされた Python 2.2 のバグフィックスリリースです。 Pyt ... 所はプロパティを使う形に書き直せ、コードが簡単になり高速化します。 さらに、属性にも docstring を付けられるようになりました。 slots を使って、インスタンスの適正な属性を特定の集合に制限できます。これはタイプミスに対する安全装置にも出来ますし、将来のバージ ... が必要になるのも size へのアクセスだけなので、ほかの属性の参照は通常の速度で実行できます。 もう一つ最後、新しいクラス属性 __slots__ を使うと、オブジェクトで参照出来る属性リストを制約することが出来ます。Python オブジェクトは普通非常に動的で、どんなときに ... もインスタンスに対して単に obj.new_attr=1 とするだけで新しい属性を定義出来ます。新スタイルクラスは __slots__ という名前のクラス属性を定義出来、これにより適正な属性名集合を特定の集合に制限出来ます。実例をみるのが早いです: >>> clas ...
https://man.mtool.work/python/3.14/whatsnew/2.2.html
PREV 1 2 3 4 NEXT