Results of 1 - 10 of about 21 for bases (0.009 sec.)
- types --- 動的な型生成と組み込み型の名前 15086
- types --- 動的な型生成と組み込み型の名前 ソースコード: Lib/types.py このモジュールは新しい型の動的な生成を支援するユーティリティ関数を定義します。 さらに、標準の Python インタプリタによって使用されているものの、 int や str のように組み込みと
...するほど基本的ではない、型に関連する補助的なユーティリティクラスや関数も提供します。 動的な型生成 types. new_class ( name , bases = () , kwds = None , exec_body = None ) 適切なメタクラスを使用して動的にクラスオブジェクトを生成します。 最初の3つの引数は...渡されない場合、それは lambda ns: None を渡すことと同じ効果があります。 Added in version 3.3. types. prepare_class ( name , bases = () , kwds = None ) 適切なメタクラスを計算してクラスの名前空間を生成します。 引数はクラス定義ヘッダーを構成する要素—クラス...トされるクラス生成プロセスの完全な詳細 PEP 3115 - Metaclasses in Python 3000 __prepare__ 名前空間フックの導入 types. resolve_bases ( bases ) PEP 560 の規定に従って MRO の項目を動的に解決します。 この関数は bases から type のインスタンスでない項目を探しま... - https://man.mtool.work/python/3.14/library/types.html
- 型オブジェクト 11450
- 型オブジェクト type PyTypeObject 次に属します: Limited API (不透明な構造体として). 組み込み型を記述する際に用いられる、オブジェクトを表す C 構造体です。 PyTypeObject PyType_Type 次に属します: Stable ABI . 型オブジェクト自身の型オブジェクトで
...p types . PyObject * PyType_FromMetaclass ( PyTypeObject * metaclass , PyObject * module , PyType_Spec * spec , PyObject * bases ) 次に属します: Stable ABI (バージョン 3.12 より). spec から ヒープ型 を作成して返します ( Py_TPFLAGS_HEAPTYPE を参照)。 T...metaclass metaclass is used 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 の場合を除...いてサポートされません。 The bases argument can be used to specify base classes; it can either be only one class or a tuple of classes. If bases is NULL , th... - https://man.mtool.work/python/3.14/c-api/type.html
- 3. データモデル 8778
- 3. データモデル 3.1. オブジェクト、値、および型 オブジェクト は、Python がデータを抽象化したものです。 Python プログラム内のすべてのデータは、オブジェクトまたはオブジェクト間の関係として表されます。 コードもオブジェクトで表されます。 すべて
.... __dict__ クラスの名前空間の読み取り専用ビューを提供する マッピングプロキシ 。 __dict__ 属性 も参照してください。 type. __bases__ クラスの基底クラスを含む tuple です。 ほとんどの場合、 class X(A, B, C) と定義したクラスの X.__bases__ は (A, B, C) と完...multiple slotted parent classes can be used, but only one parent is allowed to have attributes created by slots (the other bases must have empty slot layouts) - violations raise TypeError . もし __slots__ に対して イテレータ を使用すると、イテレータの...タクラス デフォルトでは、クラスは type() を使って構築されます。 クラス本体は新しい名前空間で実行され、クラス名が type(name, bases, namespace) の結果にローカルに束縛されます。 クラス生成プロセスはカスタマイズできます。 そのためにはクラス定義行で metacla... - https://man.mtool.work/python/3.14/reference/datamodel.html
- 型オブジェクトの構造体 8575
- 型オブジェクトの構造体 新しい型を定義する PyTypeObject 構造体は、Python のオブジェクトシステムで特に重要な構造体の 1 つです。 型オブジェクトは PyObject_* 関数や PyType_* 関数で扱えますが、ほとんどの Python アプリケーションにとって関心のある
...__init__ X X X tp_alloc allocfunc X ? ? tp_new newfunc __new__ X X ? ? tp_free freefunc X X ? ? tp_is_gc inquiry X X < tp_bases > PyObject * __bases__ ~ < tp_mro > PyObject * __mro__ ~ [ tp_cache ] PyObject * [ tp_subclasses ] void * __subclasses__ [...nc tp_new ; freefunc tp_free ; /* 低レベルのメモリ解放ルーチン */ inquiry tp_is_gc ; /* PyObject_IS_GC 用 */ PyObject * tp_bases ; PyObject * tp_mro ; /* メソッド解決順序 */ PyObject * tp_cache ; /* 現在は未使用 */ void * tp_subclasses ; /* 静的な組み...フォルト値がありません。 NULL の場合は、代わりに Py_TPFLAGS_HAVE_GC が同等の役割を果たします。 PyObject * PyTypeObject . tp_bases The corresponding slot ID Py_tp_bases is part of the Stable ABI . 基底型からなるタプルです。 このフィールドは NULL に設定し... - https://man.mtool.work/python/3.14/c-api/typeobj.html
- Python 2.3 のメソッド解決順序 8456
- Python 2.3 のメソッド解決順序 注釈 これは公式ドキュメントの付録として提供する歴史的な文書です。 ここで説明するメソッド解決順序は Python 2.3 で 導入 されましたが、Python 3 を含む後のバージョンでも使われています。 著者: Michele Simionato 。 概
...が X に先行するため、C のメソッド解決順序が曖昧になるからです。 Python 2.3 はこの場合に例外 (TypeError: MRO conflict among bases Y, X) を送出し、プログラマがうっかり曖昧な階層を作るのを防ぎます。 対して Python 2.2 は例外を送出せず、その場限りの順序 (こ...q [ 0 ] def mro ( C ): "Compute the class precedence list (mro) according to C3" return merge ([[ C ]] + map ( mro , C . __bases__ ) + [ list ( C . __bases__ )]) def print_mro ( C ): print ' \n MRO[ %s ]= %s ' % ( C , mro ( C )) print ' \n P22 MRO[ %s... - https://man.mtool.work/python/3.14/howto/mro.html
- ast --- 抽象構文木 8135
- ast --- 抽象構文木 ソースコード: Lib/ast.py ast モジュールは、Python の抽象構文を表す木を Python アプリケーションで処理するための機能を提供します。 抽象構文自体は Python のリリースごとに変わる可能性がありますが、このモジュールを使えば、現在
...decorator_list , expr ? returns , string ? type_comment , type_param * type_params ) | ClassDef ( identifier name , expr * bases , keyword * keywords , stmt * body , expr * decorator_list , type_param * type_params ) | Return ( expr ? value ) | Delete...parse ( 'nonlocal x,y,z' ), indent = 4 )) Module( body=[ Nonlocal( names=[ 'x', 'y', 'z'])]) class ast. ClassDef ( name , bases , keywords , body , decorator_list , type_params ) クラス定義です。 name はクラス名をあらわす生の文字列です。 bases は明示...rator2 ... class Foo(base1, base2, metaclass=meta): ... pass ... """ ), indent = 4 )) Module( body=[ ClassDef( name='Foo', bases=[ Name(id='base1', ctx=Load()), Name(id='base2', ctx=Load())], keywords=[ keyword( arg='metaclass', value=Name(id='meta',... - https://man.mtool.work/python/3.14/library/ast.html
- オブジェクトプロトコル (object protocol) 8033
- オブジェクトプロトコル (object protocol) PyObject * Py_GetConstant ( unsigned int constant_id ) 次に属します: Stable ABI (バージョン 3.13 より). 定数への 強参照 を取得します。 constant_id が無効な場合、例外を設定して NULL を返します。 const
...常はクラスオブジェクト、つまり type またはその派生クラスのインスタンスだけがクラスとみなされます。 ただし、オブジェクトに __bases__ 属性 (基底クラスのタプルでなければなりません) を持たせることで、この判定を変えられます。 int PyObject_IsInstance ( PyObj...れます。 インスタンス inst は __class__ 属性を持つことで、自分のクラスとみなされるものを変更できます。 オブジェクト cls は __bases__ 属性 (基底クラスのタプルでなければなりません) を持つことで、クラスとみなされるかどうか、および基底クラスを変更できます。... - https://man.mtool.work/python/3.14/c-api/object.html
- annotationlib --- アノテーションを調べるための機能 8033
- annotationlib --- アノテーションを調べるための機能 Added in version 3.14. ソースコード: Lib/annotationlib.py annotationlib モジュールは、モジュール、クラス、関数の アノテーション を調べるためのツールを提供します。 アノテーションは 遅延評価
...に格納するメタクラスです。 import annotationlib import typing class ClassVarSeparator ( type ): def __new__ ( mcls , name , bases , ns ): if "__annotations__" in ns : # from __future__ import annotations annotations = ns [ "__annotations__" ] classvar_...lassvar_keys } else : # アノテーションなし classvars = {} wrapped_annotate = None typ = super () . __new__ ( mcls , name , bases , ns ) if wrapped_annotate is not None : # 元の __annotate__ を、ClassVar を取り除くラッパーで包む typ . __annotate__ = wr... - https://man.mtool.work/python/3.14/library/annotationlib.html
- 組み込み関数 7932
- 組み込み関数 Python インタプリタには数多くの関数と型が組み込まれており、いつでも利用できます。それらをここにアルファベット順に挙げます。 組み込み関数 A abs() aiter() all() anext() any() ascii() B bin() bool() breakpoint() bytearray() bytes(
...tuple) と シーケンス型 --- list, tuple, range にドキュメント化されています。 class type ( object , / ) class type ( name , bases , dict , / , ** kwargs ) 引数が1つだけの場合、 object の型を返します。返り値は型オブジェクトで、一般に object.__class__ に...い型オブジェクトを返します。これは本質的には class 文の動的な書式です。 name 文字列はクラス名で、 __name__ 属性になります。 bases 基底クラスのタプルで、 __bases__ 属性になります; 空の場合は全てのクラスの基底クラスである object が追加されます。 dict は、... - https://man.mtool.work/python/3.14/builtins/functions.html
- デスクリプタ ガイド 7932
- デスクリプタ ガイド Author : Raymond Hettinger Contact : <python at rcn dot com> デスクリプタ を使うと、オブジェクトの属性の検索、保存、削除をカスタマイズできます。 本ガイドは4つの大項目から構成されています。 最初の「入門」では基本の紹介をし
...します。 class Type ( type ): 'Simulate how the type metaclass adds member objects for slots' def __new__ ( mcls , clsname , bases , mapping , ** kwargs ): 'Emulate type_new() in Objects/typeobject.c' # type_new() calls PyTypeReady() which calls add_met...n enumerate ( slot_names ): mapping [ name ] = Member ( name , clsname , offset ) return type . __new__ ( mcls , clsname , bases , mapping , ** kwargs ) object.__new__() メソッドはインスタンス辞書の代わりにスロットを持つインスタンスの作成の処理をします... - https://man.mtool.work/python/3.14/howto/descriptor.html