per page, with , order by , clip by
Results of 1 - 10 of about 78 for methods (0.004 sec.)
2. 拡張の型の定義: チュートリアル 15069
2. 拡張の型の定義: チュートリアル Python では、組み込みの str 型や list 型のような Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できます。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に理解しておくべ ... st" ); return NULL ; } return PyUnicode_FromFormat ( "%S %S" , self -> first , self -> last ); } static PyMethodDef Custom_methods [] = { { "name" , Custom_name , METH_NOARGS , "ファーストネームとラストネームを連結した名前を返す" }, { NULL } /* 番兵 */ ... E , . tp_new = Custom_new , . tp_init = Custom_init , . tp_dealloc = Custom_dealloc , . tp_members = Custom_members , . tp_methods = Custom_methods , }; static int custom_module_exec ( PyObject * m ) { if ( PyType_Ready ( & CustomType ) < 0 ) { return - ... 法を説明します。 さて、メソッドを定義したので、ここでメソッド定義用の配列を作成する必要があります: static PyMethodDef Custom_methods [] = { { "name" , Custom_name , METH_NOARGS , "ファーストネームとラストネームを連結した名前を返す" }, { NULL } /* 番兵 */ ...
https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html
デスクリプタオブジェクト (descriptor object) 9986
デスクリプタオブジェクト (descriptor object) "デスクリプタ (descriptor)" は、あるオブジェクトのいくつかの属性について記述したオブジェクトです。デスクリプタオブジェクトは型オブジェクトの辞書内にあります。 PyTypeObject PyProperty_Type 次に属し ... 、拡張型 type 用の新しいメソッドデスクリプタを作成します。 メソッドデスクリプタは C 関数を型のメソッドとして公開します。 tp_methods のエントリーに対して作られるものと同じ種類のデスクリプタで、Python では types.MethodDescriptorType オブジェクトとして扱われ ... or objects created by PyDescr_NewWrapper() and PyWrapper_New() . Wrapper descriptors are used internally to expose special methods such as __repr__ or __add__ , which are implemented by type slots. The type is exposed in Python as types.WrapperDescripto ... します。 クラスメソッドデスクリプタは、アクセスされた際にインスタンスの代わりにクラスを受け取る C メソッドを公開します。 tp_methods の METH_CLASS エントリーに対して作られるものと同じ種類のデスクリプタで、Python では types.ClassMethodDescriptorType オブジ ...
https://man.mtool.work/python/3.14/c-api/descriptor.html
cmd --- 行指向のコマンドインタープリターのサポート 9986
cmd --- 行指向のコマンドインタープリターのサポート ソースコード: Lib/cmd.py Cmd クラスでは、行指向のコマンドインタープリタを書くための簡単なフレームワークを提供します。テストハーネスや管理ツール、そして、後により洗練されたインターフェイスで ... d by the do_help() method. Apart from the built-in help command, most of the interpreter's behavior is defined by the do_* methods you add in your own subclass. class cmd. Cmd ( completekey = 'tab' , stdin = None , stdout = None ) Cmd インスタンス、ある ... yped in response to the prompt. This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter sh ... md. undoc_header The header to issue if the help output has a section for undocumented commands (that is, there are do_*() methods without corresponding help_*() methods). Cmd. ruler ヘルプメッセージのヘッダの下に、区切り行を表示するために使われる文字。 ...
https://man.mtool.work/python/3.14/library/cmd.html
symtable --- コンパイラーの記号表へのアクセス 9697
symtable --- コンパイラーの記号表へのアクセス ソースコード: Lib/symtable.py 記号表は、バイトコードを生成する直前にコンパイラーが AST から生成します。 コード内のすべての識別子のスコープを決める役割を担います。 symtable はこれらの記号表を調べ ... ) 変数 の名前のタプルを返します。 class symtable. Class クラスの名前空間です。 このクラスは SymbolTable を継承します。 get_methods ( ) クラス内で宣言された、メソッドに相当する関数の名前のタプルを返します。 ここで「メソッド」とは、クラス本体で def または ... async def によって定義された すべての 関数を指します。 より深いスコープ (内部クラスなど) で定義された関数は、 get_methods() の結果には含まれません。 例えば: >>> import symtable >>> st = symtable . symtable ( ''' ... def outer(): pass ... ... cl ... obal outer ... def outer(self): pass ... ''' , 'test' , 'exec' ) >>> class_A = st . get_children ()[ 2 ] >>> class_A . get_methods () ('f', 'g', 'h') A().f() は実行時に TypeError を送出しますが、 A.f はそれでもメソッドに相当する関数とみなされます。 バー ...
https://man.mtool.work/python/3.14/library/symtable.html
1. Extending Python with C or C++ 8802
1. Extending Python with C or C++ It is quite easy to add new built-in modules to Python, if you know how to program in C. Such extension modules can do two things that can't be done directly in Python: they can implement new built-in objec ... ) is called from Python programs. First, we need to list its name and address in a "method table": static PyMethodDef spam_methods [] = { ... { "system" , spam_system , METH_VARARGS , "Execute a shell command." }, ... { NULL , NULL , 0 , NULL } /* Senti ... The method table must be referenced in the module definition structure: static struct PyModuleDef spam_module = { ... . m_methods = spam_methods , ... }; This structure, in turn, must be passed to the interpreter in the module's initialization function ... e ); printf ( "-- Lovely plumage, the %s -- It's %s! \n " , type , state ); Py_RETURN_NONE ; } static PyMethodDef keywdarg_methods [] = { /* The cast of the function is necessary since PyCFunction values * only take two PyObject* parameters, and keywdar ...
https://man.mtool.work/python/3.14/extending/extending.html
3. 拡張の型の定義: 雑多なトピック 8802
3. 拡張の型の定義: 雑多なトピック この節ではさまざまな実装可能なタイプメソッドと、それらが何をするものであるかについて、ざっと説明します。 以下は PyTypeObject の定義です。 デバッグビルド でしか使われないいくつかのメンバは省いてあります: typ ... ソッド */ destructor tp_dealloc ; Py_ssize_t tp_vectorcall_offset ; getattrfunc tp_getattr ; setattrfunc tp_setattr ; PyAsyncMethods * tp_as_async ; /* 以前の名前は tp_compare (Python 2) または tp_reserved (Python 3) */ reprfunc tp_repr ; /* 標準クラス用の ... メソッド群 */ PyNumberMethods * tp_as_number ; PySequenceMethods * tp_as_sequence ; PyMappingMethods * tp_as_mapping ; /* その他の標準の操作 (バイナリ互 ... レータ */ getiterfunc tp_iter ; iternextfunc tp_iternext ; /* 属性デスクリプタとサブクラス化に関するもの */ PyMethodDef * tp_methods ; PyMemberDef * tp_members ; PyGetSetDef * tp_getset ; // ヒープ型では強参照、静的な型では借用参照 PyTypeObject * tp_base ...
https://man.mtool.work/python/3.14/extending/newtypes.html
1. 他のアプリケーションへの Python の埋め込み 8499
1. 他のアプリケーションへの Python の埋め込み 前章では、 Python を拡張する方法、すなわち C 関数のライブラリを Python に結びつけて機能を拡張する方法について述べました。同じようなことを別の方法でも実行できます: それは、自分の C/C++ アプリケー ... PyArg_ParseTuple ( args , ":numargs" )) return NULL ; return PyLong_FromLong ( numargs ); } static PyMethodDef emb_module_methods [] = { { "numargs" , emb_numargs , METH_VARARGS , "プロセスが受け取った引数の数を返します。" }, { NULL , NULL , 0 , NULL } ... }; static struct PyModuleDef emb_module = { . m_base = PyModuleDef_HEAD_INIT , . m_name = "emb" , . m_size = 0 , . m_methods = emb_module_methods , }; static PyObject * PyInit_emb ( void ) { return PyModuleDef_Init ( & emb_module ); } 上のコードを ...
https://man.mtool.work/python/3.14/extending/embedding.html
型ヒントのためのオブジェクト 8195
型ヒントのためのオブジェクト 型ヒント用の組み込み型を提供しています。 現在は GenericAlias と Union の二つがあり、このうち C に公開されているのは GenericAlias だけです。 PyObject * Py_GenericAlias ( PyObject * origin , PyObject * args ) 次に ... す。失敗した場合、例外が送出されて NULL を返します。 拡張型をジェネリックにする例を示します。 ... static PyMethodDef my_obj_methods [] = { // ほかのメソッド。 ... { "__class_getitem__" , Py_GenericAlias , METH_O | METH_CLASS , "my_obj は格納する要素の型を ...
https://man.mtool.work/python/3.14/c-api/typehints.html
非推奨 8195
非推奨 Python 3.15 で削除予定 インポートシステム: Setting __cached__ on a module while failing to set __spec__.cached is deprecated. In Python 3.15, __cached__ will cease to be set or take into consideration by the import system or standard ... e typing module, it has yet to be supported by any major type checker. wave : The getmark() , setmark() , and getmarkers() methods of the Wave_read and Wave_write classes have been deprecated since Python 3.13. zipimport : load_module() has been depreca ... す。 Python 3.4 以降は shutil のどの関数でも使われておらず、現在は RuntimeError の別名になっています。 symtable : Class.get_methods メソッドは Python 3.14 から非推奨です。 sys : _enablelegacywindowsfsencoding() 関数は Python 3.13 から非推奨です。 代わりに ... のリリースでは構文エラーになります。 ( gh-87999 ) Support for __index__() and __int__() method returning non-int type: these methods will be required to return an instance of a strict subclass of int . __float__() メソッドが float の厳密なサブクラスのイン ...
https://man.mtool.work/python/3.14/deprecations/
The Python Profilers 8195
The Python Profilers Source code: Lib/profile.py and Lib/pstats.py Introduction to the profilers cProfile and profile provide deterministic profiling of Python programs. A profile is a set of statistics that describes how often and for how ... tion to cProfile . Added in version 3.8: Added the -m option to profile . The pstats module's Stats class has a variety of methods for manipulating and printing the data saved into a profile results file: import pstats from pstats import SortKey p = pst ... s ( - 1 ) . print_stats () The strip_dirs() method removed the extraneous path from all the module names. The sort_stats() method sorted all the entries according to the standard module/line/name string that is printed. The print_stats() method printed ... stats ( '__init__' ) This will sort all the statistics by file name, and then print out statistics for only the class init methods (since they are spelled with __init__ in them). As one final example, you could try: p . sort_stats ( SortKey . TIME , Sor ...
https://man.mtool.work/python/3.14/library/profile.html
PREV 1 2 3 4 5 6 7 8 NEXT