Results of 1 - 10 of about 115 for number (0.006 sec.)
- timeit --- 小さなコードスニペットの実行時間計測 13347
- timeit --- 小さなコードスニペットの実行時間計測 ソースコード: Lib/timeit.py このモジュールは、小さな Python コードの実行時間を簡単に計測する手段を提供します。 Command-Line Interface と、 Python から呼び出せるインターフェース の両方があります
...Interface を使って実現することもできます: >>> import timeit >>> timeit . timeit ( '"-".join(str(n) for n in range(100))' , number = 10000 ) 0.3018611848820001 >>> timeit . timeit ( '"-".join([str(n) for n in range(100)])' , number = 10000 ) 0.272736879...0656328 >>> timeit . timeit ( '"-".join(map(str, range(100)))' , number = 10000 ) 0.23702679807320237 呼び出し可能オブジェクトは Python Interface から渡すこともできます: >>> timeit . timeit ( la...mbda : "-" . join ( map ( str , range ( 100 ))), number = 10000 ) 0.19665591977536678 ただし、 timeit() はコマンドラインインターフェイスを使った時だけ繰り返し回数を自動で決定する... - https://man.mtool.work/python/3.14/library/timeit.html
- 10. 完全な文法仕様 12229
- 10. 完全な文法仕様 以下は Python の完全な文法で、CPython のパーサを生成するための文法から直接得たものです ( Grammar/python.gram を参照)。 ここでは、コード生成とエラー回復に関する詳細を省略しています。 ここで使う記法は、これまでのドキュメント
...pping_pattern | class_pattern # Literal patterns are used for equality and identity constraints literal_pattern : | signed_number ! ( '+' | '-' ) | complex_number | strings | 'None' | 'True' | 'False' # Literal expressions are used to restrict permitte...d mapping pattern keys literal_expr : | signed_number ! ( '+' | '-' ) | complex_number | strings | 'None' | 'True' | 'False' complex_number : | signed_real_number '+' imaginary..._number | signed_real_number '-' imaginary_number signed_number : | NUMBER | '-' NUMBER signed_real_number : | real_number | '-' r... - https://man.mtool.work/python/3.14/reference/grammar.html
- 2. 拡張の型の定義: チュートリアル 11413
- 2. 拡張の型の定義: チュートリアル Python では、組み込みの str 型や list 型のような Python コードから操作できる新しい型を C 拡張モジュールの作者が定義できます。 全ての拡張の型のコードはあるパターンに従うのですが、書き始める前に理解しておくべ
...() 用 */ typedef struct { PyObject_HEAD PyObject * first ; /* ファーストネーム */ PyObject * last ; /* ラストネーム */ int number ; } CustomObject ; static void Custom_dealloc ( PyObject * op ) { CustomObject * self = ( CustomObject * ) op ; Py_XDECREF...last = Py_GetConstant ( Py_CONSTANT_EMPTY_STR ); if ( self -> last == NULL ) { Py_DECREF ( self ); return NULL ; } self -> number = 0 ; } return ( PyObject * ) self ; } static int Custom_init ( PyObject * op , PyObject * args , PyObject * kwds ) { Cust...omObject * self = ( CustomObject * ) op ; static char * kwlist [] = { "first" , "last" , "number" , NULL }; PyObject * first = NULL , * last = NULL ; if ( ! PyArg_ParseTupleAndKeywords ( args , kwds , "|OOi" , kwlist ,... - https://man.mtool.work/python/3.14/extending/newtypes_tutorial.html
- decimal --- 10進固定小数点と浮動小数点の演算 9078
- decimal --- 10進固定小数点と浮動小数点の演算 ソースコード: Lib/decimal.py decimal モジュールは、高速で正しく丸められる 10 進浮動小数点演算をサポートします。 float データ型に比べて次のような利点があります: Decimal は「人間を念頭に設計された
...はタプルから構成できます。整数や浮動小数点数からの構成は、整数や浮動小数点数の値を正確に変換します。 Decimal は "非数 (Not a Number)" を表す NaN や正負の Infinity (無限大)、 -0 といった特殊な値も表現できます: >>> getcontext () . prec = 28 >>> Decimal ( 1...cimal('Infinity') >>> Decimal . from_float ( float ( '-inf' )) Decimal('-Infinity') Added in version 3.1. classmethod from_number ( number , / ) float 、 int 、 Decimal のインスタンスだけを受け付け、文字列やタプルは受け付けない、別形式のコンストラクタで...す。 >>> Decimal . from_number ( 314 ) Decimal('314') >>> Decimal . from_number ( 0.1 ) Decimal('0.100000000000000005551115123125782702118158340454101562... - https://man.mtool.work/python/3.14/library/decimal.html
- threading --- スレッドベースの並列処理 8676
- threading --- スレッドベースの並列処理 ソースコード: Lib/threading.py このモジュールでは、高水準のスレッドインターフェースをより低水準 な _thread モジュールの上に構築しています。 利用可能な環境 : not WASI. このモジュールは WebAssembly では動
...だけで使いたいデータがある場合は、 local オブジェクトを作成し、その属性を使ってください。 >>> mydata = local () >>> mydata . number = 42 >>> mydata . number 42 local オブジェクトの辞書にもアクセスできます。 >>> mydata . __dict__ {'number': 42} >>> mydata...ます。 >>> log = [] >>> def f (): ... items = sorted ( mydata . __dict__ . items ()) ... log . append ( items ) ... mydata . number = 11 ... log . append ( mydata . number ) >>> import threading >>> thread = threading . Thread ( target = f ) >>> thread ....11] 異なるデータが得られます。 また、別のスレッドで変更しても、このスレッドから見えるデータには影響しません。 >>> mydata . number 42 __dict__ 属性を含め、 local オブジェクトから取得した値は、その属性を読み出したときのスレッドのものです。 値は取得元のス... - https://man.mtool.work/python/3.14/library/threading.html
- A Conceptual Overview of asyncio 8061
- A Conceptual Overview of asyncio この HOWTO では、 asyncio の基本的な仕組みをしっかり理解できるように説明します。 推奨される書き方がどのように動き、なぜ推奨されるのかを理解する助けになるでしょう。 asyncio の主要な概念について、疑問を持ってい
...ン関数」) になります。 これを呼び出すと、 コルーチン オブジェクトが作られて返されます。 async def loudmouth_penguin ( magic_number : int ): print ( "I am a super special talking penguin. Far cooler than that printer. " f "By the way, my lucky number is:...{ magic_number } ." ) 非同期関数 loudmouth_penguin を呼び出しても、print 文は実行されません。 代わりに、コルーチンオブジェクトが作られます...。 >>> loudmouth_penguin ( magic_number = 3 ) <coroutine object loudmouth_penguin at 0x104ed2740> 「コルーチン関数」と「コルーチンオブジェクト」は、どちらも単にコ... - https://man.mtool.work/python/3.14/howto/a-conceptual-overview-of-asyncio.html
- Argparse チュートリアル 7960
- Argparse チュートリアル author : Tshepang Mbambo このチュートリアルでは、 argparse を丁寧に説明します。 argparse は、Python 標準ライブラリの一部であり、おすすめのコマンドライン引数の解析モジュールです。 注釈 標準ライブラリには、コマンドライ
...port argparse parser = argparse . ArgumentParser () parser . add_argument ( "square" , help = "display a square of a given number" ) args = parser . parse_args () print ( args . square ** 2 ) 下記がこのコードを実行した結果です: $ python prog.py 4 Trace...port argparse parser = argparse . ArgumentParser () parser . add_argument ( "square" , help = "display a square of a given number" , type = int ) args = parser . parse_args () print ( args . square ** 2 ) 下記がこのコードを実行した結果です: $ python pr...parser = argparse . ArgumentParser () parser . add_argument ( "square" , type = int , help = "display a square of a given number" ) parser . add_argument ( "-v" , "--verbose" , action = "store_true" , help = "increase output verbosity" ) args = parser... - https://man.mtool.work/python/3.14/howto/argparse.html
- 2. 字句解析 7960
- 2. 字句解析 Python プログラムは パーザ によって読み取られます。 パーザへの入力は、 字句解析器 (または トークナイザ ) が生成した トークン の列です。 この章では、字句解析器がこれらのトークンを生成する方法を説明します。 字句解析器はプログラムの
...ークンを生成します。 2.2. その他のトークン NEWLINE 、 INDENT 、 DEDENT のほかに、 識別子 と キーワード ( NAME )、 リテラル ( NUMBER や STRING など)、その他の記号 ( 演算子 と デリミタ 、 OP ) という種類のトークンがあります。 空白文字は、前述の論理行の終端...rite_color } ' ) Galahad: blue >>> print ( rf "C:\Users\ { name } " ) C:\Users\Galahad >>> print ( f '''Three shall be the number of the counting ... and the number of the counting shall be three.''' ) Three shall be the number of the counting and the...置換フィールドの値の書式化に使われます。 例えば 書式指定ミニ言語 を使って、フィールドの幅や埋め草の文字を指定できます。 >>> number = 14.3 >>> f ' { number : 20.7f } ' ' 14.3000000' 最上位の書式指定子には、入れ子の置換フィールドを含められます。 >>> field... - https://man.mtool.work/python/3.14/reference/lexical_analysis.html
- 複素数オブジェクト 7759
- 複素数オブジェクト Python's complex number objects are implemented as two distinct types when viewed from the C API: one is the Python object exposed to Python programs, and the other is a C structure which represents the actual complex number
...consistent throughout the API. type Py_complex The C structure which corresponds to the value portion of a Python complex number object. Most of the functions for dealing with complex number objects use structures of this type as input or output value...数でない場合、この関数はゼロを返し、 errno に EDOM を設定します。 オーバーフロー時は errno に ERANGE を設定します。 Complex Numbers as Python Objects type PyComplexObject この PyObject のサブタイプは Python の複素数型を表現します。 PyTypeObject PyComple... - https://man.mtool.work/python/3.14/c-api/complex.html
- The Python Profilers 7759
- 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
...ered by: cumulative time indicates the output is sorted by the cumtime values. The column headings include: ncalls for the number of calls. tottime for the total time spent in the given function (and excluding time made in calls to sub-functions) perca...time divided by primitive calls filename:lineno(function) provides the respective data of each function When there are two numbers in the first column (for example 3/1 ), it means that the function recursed. The second value is the number of primitive...calls and the former is the total number of calls. Note that when the function does not recurse, these two values are the same, and only the single figure is print... - https://man.mtool.work/python/3.14/library/profile.html