per page, with , order by , clip by
Results of 1 - 10 of about 312 for self (0.016 sec.)
デスクリプタ ガイド — Python 3.14.8 ドキュメント 8453
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » デスクリプタ ガイド テーマ 自動 ライト ダーク | デスクリプタ ガイド ¶ Author : Raymond Hettinger Contact : <python at rcn dot com> デスクリプタ を ... スクリプタ ¶ The Ten class is a descriptor whose __get__() method always returns the constant 10 : class Ten : def __get__ ( self , obj , objtype = None ): return 10 このデスクリプタを使うには他のクラスのクラス変数として保存します: class A : x = 5 # Re ... 単に定数を返すよりも、なにか処理を実行するデスクリプタの方が面白いでしょう。 import os class DirectorySize : def __get__ ( self , obj , objtype = None ): return len ( os . listdir ( obj . dirname )) class Directory : size = DirectorySize () # Descrip ... tor instance def __init__ ( self , dirname ): self . dirname = dirname # Regular instance attribute インタラクティブセッションで見たように、この探索は動的で ...
https://man.mtool.work/python/3.14/howto/descriptor.html
デスクリプタ ガイド — Python 3.14.8 ドキュメント 8453
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » デスクリプタ ガイド テーマ 自動 ライト ダーク | デスクリプタ ガイド ¶ Author : Raymond Hettinger Contact : <python at rcn dot com> デスクリプタ を ... スクリプタ ¶ The Ten class is a descriptor whose __get__() method always returns the constant 10 : class Ten : def __get__ ( self , obj , objtype = None ): return 10 このデスクリプタを使うには他のクラスのクラス変数として保存します: class A : x = 5 # Re ... 単に定数を返すよりも、なにか処理を実行するデスクリプタの方が面白いでしょう。 import os class DirectorySize : def __get__ ( self , obj , objtype = None ): return len ( os . listdir ( obj . dirname )) class Directory : size = DirectorySize () # Descrip ... tor instance def __init__ ( self , dirname ): self . dirname = dirname # Regular instance attribute インタラクティブセッションで見たように、この探索は動的で ...
https://man.mtool.work/python/3.14/howto/descriptor.html
2. 拡張の型の定義: チュートリアル — Python 3.14.8 ドキュメント 8173
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python インタプリタの拡張と埋め込み » 2. 拡張の型の定義: チュートリアル テーマ 自動 ライト ダーク | 2. 拡張の型の定義: チュートリアル ¶ Python では、組み込みの s ... bject * last ; /* last name */ int number ; } CustomObject ; static void Custom_dealloc ( PyObject * op ) { CustomObject * self = ( CustomObject * ) op ; Py_XDECREF ( self -> first ); Py_XDECREF ( self -> last ); Py_TYPE ( self ) -> tp_free ( self ); ... } static PyObject * Custom_new ( PyTypeObject * type , PyObject * args , PyObject * kwds ) { CustomObject * self ; self = ( CustomObject * ) type -> tp_alloc ( type , 0 ); if ( self != NULL ) { self -> first = Py_GetConstant ( Py_CONST ... ANT_EMPTY_STR ); if ( self -> first == NULL ) { Py_DECREF ( self ); return NULL ; } self -> last = Py_GetConstant ( Py_CONSTANT_EMPTY_STR ); if ( sel ...
https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html
2. 拡張の型の定義: チュートリアル — Python 3.14.8 ドキュメント 8173
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python インタプリタの拡張と埋め込み » 2. 拡張の型の定義: チュートリアル テーマ 自動 ライト ダーク | 2. 拡張の型の定義: チュートリアル ¶ Python では、組み込みの s ... bject * last ; /* last name */ int number ; } CustomObject ; static void Custom_dealloc ( PyObject * op ) { CustomObject * self = ( CustomObject * ) op ; Py_XDECREF ( self -> first ); Py_XDECREF ( self -> last ); Py_TYPE ( self ) -> tp_free ( self ); ... } static PyObject * Custom_new ( PyTypeObject * type , PyObject * args , PyObject * kwds ) { CustomObject * self ; self = ( CustomObject * ) type -> tp_alloc ( type , 0 ); if ( self != NULL ) { self -> first = Py_GetConstant ( Py_CONST ... ANT_EMPTY_STR ); if ( self -> first == NULL ) { Py_DECREF ( self ); return NULL ; } self -> last = Py_GetConstant ( Py_CONSTANT_EMPTY_STR ); if ( sel ...
https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html
Logging クックブック — Python 3.14.8 ドキュメント 7959
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » Logging クックブック テーマ 自動 ライト ダーク | Logging クックブック ¶ Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に ... ging # create logger module_logger = logging . getLogger ( 'spam_application.auxiliary' ) class Auxiliary : def __init__ ( self ): self . logger = logging . getLogger ( 'spam_application.auxiliary.Auxiliary' ) self . logger . info ( 'creating an inst ... ance of Auxiliary' ) def do_something ( self ): self . logger . info ( 'doing something' ) a = 1 + 1 self . logger . info ( 'done doing something' ) def some_function ... ming logging request. This basically logs the record using whatever logging policy is configured locally. """ def handle ( self ): """ Handle multiple requests - each expected to be a 4-byte length, followed by the LogRecord in pickle format. Logs th ...
https://man.mtool.work/python/3.14/howto/logging-cookbook.html
Logging クックブック — Python 3.14.8 ドキュメント 7772
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » Logging クックブック テーマ 自動 ライト ダーク | Logging クックブック ¶ Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に ... ging # create logger module_logger = logging . getLogger ( 'spam_application.auxiliary' ) class Auxiliary : def __init__ ( self ): self . logger = logging . getLogger ( 'spam_application.auxiliary.Auxiliary' ) self . logger . info ( 'creating an inst ... ance of Auxiliary' ) def do_something ( self ): self . logger . info ( 'doing something' ) a = 1 + 1 self . logger . info ( 'done doing something' ) def some_function ... ming logging request. This basically logs the record using whatever logging policy is configured locally. """ def handle ( self ): """ Handle multiple requests - each expected to be a 4-byte length, followed by the LogRecord in pickle format. Logs th ...
https://man.mtool.work/python/3.14/howto/logging-cookbook.html
3. データモデル — Python 3.14.8 ドキュメント 7147
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python 言語リファレンス » 3. データモデル テーマ 自動 ライト ダーク | 3. データモデル ¶ 3.1. オブジェクト、値、および型 ¶ Objects are Python's abstraction for da ... of expressions. A tuple of one item (a 'singleton') can be formed by affixing a comma to an expression (an expression by itself does not create a tuple, since parentheses must be usable for grouping of expressions). An empty tuple can be formed by an ... インスタンスと任意の呼び出し可能オブジェクト (通常はユーザ定義関数) を結びつけます。 Special read-only attributes: method. __self__ ¶ Refers to the class instance object to which the method is bound method. __func__ ¶ Refers to the original function ob ... nstance method object is created by retrieving a user-defined function object from a class via one of its instances, its __self__ attribute is the instance, and the method object is said to be bound . The new method's __func__ attribute is the origin ...
https://man.mtool.work/python/3.14/reference/datamodel.html
3. データモデル — Python 3.14.8 ドキュメント 7100
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python 言語リファレンス » 3. データモデル テーマ 自動 ライト ダーク | 3. データモデル ¶ 3.1. オブジェクト、値、および型 ¶ Objects are Python's abstraction for da ... of expressions. A tuple of one item (a 'singleton') can be formed by affixing a comma to an expression (an expression by itself does not create a tuple, since parentheses must be usable for grouping of expressions). An empty tuple can be formed by an ... インスタンスと任意の呼び出し可能オブジェクト (通常はユーザ定義関数) を結びつけます。 Special read-only attributes: method. __self__ ¶ Refers to the class instance object to which the method is bound method. __func__ ¶ Refers to the original function ob ... nstance method object is created by retrieving a user-defined function object from a class via one of its instances, its __self__ attribute is the instance, and the method object is said to be bound . The new method's __func__ attribute is the origin ...
https://man.mtool.work/python/3.14/reference/datamodel.html
unittest.mock --- 入門 — Python 3.14.8 ドキュメント 7007
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- 入門 テーマ 自動 ライト ダーク | unittest.mock --- 入門 ¶ Added in version 3.3. Mock を使う ¶ Mock p ... uctionClass().method が something メソッドを呼び出したことをテストしています: >>> class ProductionClass : ... def method ( self ): ... self . something ( 1 , 2 , 3 ) ... def something ( self , a , b , c ): ... pass ... >>> real = ProductionClass () > ... っています。このメソッドは渡されたオブジェクトの close メソッドを呼び出します。 >>> class ProductionClass : ... def closer ( self , something ): ... something . close () ... ですからこれをテストするには、 close メソッドを持ったオブジェクトを渡して、それ ... __ と __aexit__ は非同期関数を返す AsyncMock インスタンスです。 >>> class AsyncContextManager : ... async def __aenter__ ( self ): ... return self ... async def __aexit__ ( self , exc_type , exc , tb ): ... pass ... >>> mock_instance = MagicMock ( As ...
https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
unittest.mock --- 入門 — Python 3.14.8 ドキュメント 6979
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » unittest.mock --- 入門 テーマ 自動 ライト ダーク | unittest.mock --- 入門 ¶ Added in version 3.3. Mock を使う ¶ Mock p ... uctionClass().method が something メソッドを呼び出したことをテストしています: >>> class ProductionClass : ... def method ( self ): ... self . something ( 1 , 2 , 3 ) ... def something ( self , a , b , c ): ... pass ... >>> real = ProductionClass () > ... っています。このメソッドは渡されたオブジェクトの close メソッドを呼び出します。 >>> class ProductionClass : ... def closer ( self , something ): ... something . close () ... ですからこれをテストするには、 close メソッドを持ったオブジェクトを渡して、それ ... __ と __aexit__ は非同期関数を返す AsyncMock インスタンスです。 >>> class AsyncContextManager : ... async def __aenter__ ( self ): ... return self ... async def __aexit__ ( self , exc_type , exc , tb ): ... pass ... >>> mock_instance = MagicMock ( As ...
https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
PREV 1 2 3 4 5 6 7 8 9 10 NEXT