Results of 1 - 10 of about 117 for isinstance (0.010 sec.)
- numbers --- 数の抽象基底クラス — Python 3.14.8 ドキュメント 13638
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 数値と数学モジュール » numbers --- 数の抽象基底クラス テーマ 自動 ライト ダーク | numbers --- 数の抽象基底クラス ¶ ソースコード: Li
...instantiated. class numbers. Number ¶ 数の階層の根。引数 x が、種類は何であれ、数であるということだけチェックしたい場合、 isinstance(x, Number) が使えます。 数値塔 ¶ class numbers. Complex ¶ この型のサブクラスは複素数を表し、組み込みの complex 型を受け付け...means that __add__() and __radd__() should be defined as: class MyIntegral ( Integral ): def __add__ ( self , other ): if isinstance ( other , MyIntegral ): return do_my_adding_stuff ( self , other ) elif isinstance ( other , OtherTypeIKnowAbout ): return...do_my_other_adding_stuff ( self , other ) else : return NotImplemented def __radd__ ( self , other ): if isinstance ( other , MyIntegral ): return do_my_adding_stuff ( other , self ) elif isinstance ( other , OtherTypeIKnowAbout ): return... - https://man.mtool.work/python/3.14/library/numbers.html
- numbers --- 数の抽象基底クラス — Python 3.14.8 ドキュメント 13638
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 数値と数学モジュール » numbers --- 数の抽象基底クラス テーマ 自動 ライト ダーク | numbers --- 数の抽象基底クラス ¶ ソースコード: Li
...instantiated. class numbers. Number ¶ 数の階層の根。引数 x が、種類は何であれ、数であるということだけチェックしたい場合、 isinstance(x, Number) が使えます。 数値塔 ¶ class numbers. Complex ¶ この型のサブクラスは複素数を表し、組み込みの complex 型を受け付け...means that __add__() and __radd__() should be defined as: class MyIntegral ( Integral ): def __add__ ( self , other ): if isinstance ( other , MyIntegral ): return do_my_adding_stuff ( self , other ) elif isinstance ( other , OtherTypeIKnowAbout ): return...do_my_other_adding_stuff ( self , other ) else : return NotImplemented def __radd__ ( self , other ): if isinstance ( other , MyIntegral ): return do_my_adding_stuff ( other , self ) elif isinstance ( other , OtherTypeIKnowAbout ): return... - https://man.mtool.work/python/3.14/library/numbers.html
- collections.abc --- コンテナの抽象基底クラス — Python 3.14.8 ドキュメント 10087
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » データ型 » collections.abc --- コンテナの抽象基底クラス テーマ 自動 ライト ダーク | collections.abc --- コンテナの抽象基底クラス ¶
...スが特定のインターフェースを提供しているか、例えば ハッシュ可能 であるかや マッピング であるかを判定します。 issubclass() や isinstance() を使ったインターフェースに対するテストは、以下の3つのいずれかの方法で動作します。 A newly written class can inherit dire...tract method def count ( self , value ): ... # Optionally override a mixin method >>> issubclass ( C , Sequence ) True >>> isinstance ( C (), Sequence ) True Existing classes and built-in classes can be registered as "virtual subclasses" of the ABCs. Those...e the full API including all of the abstract methods and all of the mixin methods. This lets users rely on issubclass() or isinstance() tests to determine whether the full interface is supported. The exception to this rule is for methods that are automatic... - https://man.mtool.work/python/3.14/library/collections.abc.html
- collections.abc --- コンテナの抽象基底クラス — Python 3.14.8 ドキュメント 10087
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » データ型 » collections.abc --- コンテナの抽象基底クラス テーマ 自動 ライト ダーク | collections.abc --- コンテナの抽象基底クラス ¶
...スが特定のインターフェースを提供しているか、例えば ハッシュ可能 であるかや マッピング であるかを判定します。 issubclass() や isinstance() を使ったインターフェースに対するテストは、以下の3つのいずれかの方法で動作します。 A newly written class can inherit dire...tract method def count ( self , value ): ... # Optionally override a mixin method >>> issubclass ( C , Sequence ) True >>> isinstance ( C (), Sequence ) True Existing classes and built-in classes can be registered as "virtual subclasses" of the ABCs. Those...e the full API including all of the abstract methods and all of the mixin methods. This lets users rely on issubclass() or isinstance() tests to determine whether the full interface is supported. The exception to this rule is for methods that are automatic... - https://man.mtool.work/python/3.14/library/collections.abc.html
- Pending removal in Python 3.17 — Python 3.14.8 ドキュメント 8225
- ナビゲーション 索引 モジュール | Python » 3.14.8 Documentation » Pending removal in Python 3.17 テーマ 自動 ライト ダーク | Pending removal in Python 3.17 ¶ collections.abc : collections.abc.ByteString is scheduled for removal in Python 3.1
...7. Use isinstance(obj, collections.abc.Buffer) to test if obj implements the buffer protocol at runtime. For use in type annotations, either...vate implementation details. typing.ByteString , deprecated since Python 3.9, is scheduled for removal in Python 3.17. Use isinstance(obj, collections.abc.Buffer) to test if obj implements the buffer protocol at runtime. For use in type annotations, either...never typing removal collections Buffer buffer runtime type types bytes bytearray memoryview scheduled since were details isinstance implements protocol annotations union explicitly specifies code This page Report a bug Improve this page Show source Show... - https://man.mtool.work/python/3.14/deprecations/pending-removal-in-3.17.html
- typing --- 型ヒントのサポート — Python 3.14.8 ドキュメント 8012
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » typing --- 型ヒントのサポート テーマ 自動 ライト ダーク | typing --- 型ヒントのサポート ¶ Added in version 3.5. ソース
...th Union[int, str] and int | str create instances of the same class. To check whether an object is a Union at runtime, use isinstance(obj, Union) . For compatibility with earlier versions of Python, use get_origin(obj) is typing.Union or get_origin(obj) is...riable ClassVar は型のみを受け入れ、それ以外は受け付けられません。 ClassVar is not a class itself, and cannot be used with isinstance() or issubclass() . ClassVar does not change Python runtime behavior, but it can be used by static type checkers. For exam...ry encountering an Annotated type can scan through the metadata elements to determine if they are of interest (e.g., using isinstance() ). Annotated[<type>, <metadata>] Here is an example of how you might use Annotated to add metadata to type annotations i... - https://man.mtool.work/python/3.14/library/typing.html
- typing --- 型ヒントのサポート — Python 3.14.8 ドキュメント 8012
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » typing --- 型ヒントのサポート テーマ 自動 ライト ダーク | typing --- 型ヒントのサポート ¶ Added in version 3.5. ソース
...th Union[int, str] and int | str create instances of the same class. To check whether an object is a Union at runtime, use isinstance(obj, Union) . For compatibility with earlier versions of Python, use get_origin(obj) is typing.Union or get_origin(obj) is...riable ClassVar は型のみを受け入れ、それ以外は受け付けられません。 ClassVar is not a class itself, and cannot be used with isinstance() or issubclass() . ClassVar does not change Python runtime behavior, but it can be used by static type checkers. For exam...ry encountering an Annotated type can scan through the metadata elements to determine if they are of interest (e.g., using isinstance() ). Annotated[<type>, <metadata>] Here is an example of how you might use Annotated to add metadata to type annotations i... - https://man.mtool.work/python/3.14/library/typing.html
- What's New In Python 3.12 — Python 3.14.8 ドキュメント 7912
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New In Python 3.12 テーマ 自動 ライト ダーク | What's New In Python 3.12 ¶ 編集者 : Adam Turner この記事では Python 3.11 と比較した
...加えられました sqlite3 モジュールに コマンドライン・インターフェース が追加されました runtime-checkable プロトコル に対する isinstance() のチェックは、2倍~20倍のスピードアップを実現します asyncio パッケージは多くのパフォーマンスを向上させ、いくつかのベンチ...ユーザー定義のジェネリック型 when subclassed. (Contributed by James Hilton-Balfe and Alex Waygood in gh-101827 .) typing ¶ isinstance() checks against runtime-checkable protocols now use inspect.getattr_static() rather than hasattr() to lookup whether attr...ibutes exist. This means that descriptors and __getattr__() methods are no longer unexpectedly evaluated during isinstance() checks against runtime-checkable protocols. However, it may also mean that some objects which used to be considered inst... - https://man.mtool.work/python/3.14/whatsnew/3.12.html
- What's New In Python 3.12 — Python 3.14.8 ドキュメント 7912
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New In Python 3.12 テーマ 自動 ライト ダーク | What's New In Python 3.12 ¶ 編集者 : Adam Turner この記事では Python 3.11 と比較した
...加えられました sqlite3 モジュールに コマンドライン・インターフェース が追加されました runtime-checkable プロトコル に対する isinstance() のチェックは、2倍~20倍のスピードアップを実現します asyncio パッケージは多くのパフォーマンスを向上させ、いくつかのベンチ...ユーザー定義のジェネリック型 when subclassed. (Contributed by James Hilton-Balfe and Alex Waygood in gh-101827 .) typing ¶ isinstance() checks against runtime-checkable protocols now use inspect.getattr_static() rather than hasattr() to lookup whether attr...ibutes exist. This means that descriptors and __getattr__() methods are no longer unexpectedly evaluated during isinstance() checks against runtime-checkable protocols. However, it may also mean that some objects which used to be considered inst... - https://man.mtool.work/python/3.14/whatsnew/3.12.html
- プログラミング FAQ — Python 3.14.8 ドキュメント 7700
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python よくある質問 » プログラミング FAQ テーマ 自動 ライト ダーク | プログラミング FAQ ¶ 一般的な質問 ¶ ブレークポイントやステップ実行ができる、ソースコードレベ
...オブジェクトが、与えられたクラスやそのサブクラスのインスタンスであるかを調べるにはどうしますか? ¶ Use the built-in function isinstance(obj, cls) . You can check if an object is an instance of any of a number of classes by providing a tuple instead of a sing...le class, for example, isinstance(obj, (class1, class2, ...)) , and can also check whether an object is one of Python's built-in types, for example, isinsta...nce(obj, str) or isinstance(obj, (int, float, complex)) . Note that isinstance() also checks for virtual inheritance from an abstract base class . So,... - https://man.mtool.work/python/3.14/faq/programming.html