per page, with , order by , clip by
Results of 1 - 10 of about 192 for list (0.011 sec.)
リストオブジェクト 15397
リストオブジェクト type PyListObject この PyObject のサブタイプは Python のリストオブジェクトを表現します。 PyTypeObject PyList_Type 次に属します: Stable ABI . この PyTypeObject のインスタンスは Python のリスト型を表現します。これは Python ... レイヤにおける list と同じオブジェクトです。 int PyList_Check ( PyObject * p ) Thread safety: Atomic . p がリストオブジェクトかリスト型のサブタ ... イプのインスタンスである場合に真を返します。この関数は常に成功します。 int PyList_CheckExact ( PyObject * p ) Thread safety: Atomic . p がリストオブジェクトだがリスト型のサブタイプのインスタンスでない場合 ... に真を返します。この関数は常に成功します。 PyObject * PyList_New ( Py_ssize_t len ) 戻り値: 新しい参照。 次に属します: Stable ABI . Thread safety: Atomic . サイズが len 新たなリストオ ...
https://man.mtool.work/python/3.14/c-api/list.html
6. 式 (expression) 9576
6. 式 (expression) この章では、Python の式における個々の要素の意味について解説します。 構文上の注意: この章以降では、 文法の表記法 を字句解析ではなく構文の記述に使います。 構文規則の (選択肢の 1 つの) 形式が次のように記述され、 name : other ... 次のとおりです。 atom : | 'True' | 'False' | 'None' | '...' | identifier | literal | enclosure enclosure : | parenth_form | list_display | dict_display | set_display | generator_expression | yield_atom 6.2.1. 組み込み定数 キーワード True 、 False 、 N ... ます。 strings : ( STRING | fstring )+ | tstring + 6.2.4. Parenthesized forms A parenthesized form is an optional expression list enclosed in parentheses: parenth_form : "(" [ starred_expression ] ")" A parenthesized expression list yields whatever tha ... t expression list yields: if the list contains at least one comma, it yields a tuple; otherwise, it yields the single expression that makes ...
https://man.mtool.work/python/3.14/reference/expressions.html
typing --- 型ヒントのサポート 8607
typing --- 型ヒントのサポート Added in version 3.5. ソースコード: Lib/typing.py 注釈 Python ランタイムは、関数や変数の型アノテーションを強制しません。型アノテーションは、 type checkers や IDE、linterなどのサードパーティーツールで使われます。 ... アス 型エイリアスは type 文を用いて定義され、これにより TypeAliasType インスタンスが生成されます。 以下の例では、 Vector と list[float] は静的型チェッカーによって同じ型とみなされます: type Vector = list [ float ] def scale ( scalar : float , vector : ... Vector ) -> Vector : return [ scalar * num for num in vector ] # floatのlistはVectorとして要件を満たすため、型チェックを通過する。 new_vector = scale ( 2.0 , [ 1.0 , - 4.2 , 5.4 ]) 型エイリアスは複雑な ... 文はPython 3.12で新しく導入されました。 後方互換性のために、単に代入によって型エイリアスを作成することもできます。 Vector = list [ float ] あるいは、 TypeAlias でマークすることで、これが通常の変数代入ではなく、型エイリアスであることを明示できます。 fr ...
https://man.mtool.work/python/3.14/library/typing.html
ast --- 抽象構文木 7856
ast --- 抽象構文木 ソースコード: Lib/ast.py ast モジュールは、Python の抽象構文を表す木を Python アプリケーションで処理するための機能を提供します。 抽象構文自体は Python のリリースごとに変わる可能性がありますが、このモジュールを使えば、現在 ... ( expr * argtypes , expr returns ) stmt = FunctionDef ( identifier name , arguments args , stmt * body , expr * decorator_list , expr ? returns , string ? type_comment , type_param * type_params ) | AsyncFunctionDef ( identifier name , arguments arg ... s , stmt * body , expr * decorator_list , expr ? returns , string ? type_comment , type_param * type_params ) | ClassDef ( identifier name , expr * bases , keywor ... d * keywords , stmt * body , expr * decorator_list , type_param * type_params ) | Return ( expr ? value ) | Delete ( expr * targets ) | Assign ( expr * targets , expr value ...
https://man.mtool.work/python/3.14/library/ast.html
5. データ構造 7726
5. データ構造 この章では、すでに学んだことについてより詳しく説明するとともに、いくつか新しいことを追加します。 5.1. リスト型についてもう少し list 型には、他にもいくつかメソッドがあります。リストオブジェクトのすべてのメソッドを以下に示します ... : list. append ( value , / ) リストの末尾に要素を一つ追加します。 a[len(a):] = [x] と同様です。 list. extend ( iterable , / ) ite ... rable のすべての要素をリストの末尾に追加します。 a[len(a):] = iterable と同様です。 list. insert ( index , value , / ) 指定した位置に要素を挿入します。第 1 引数は、リストのインデクスで、そのインデクスを持つ要素の ... 入が行われます。従って、 a.insert(0, x) はリストの先頭に挿入を行います。また a.insert(len(a), x) は a.append(x) と等価です。 list. remove ( value , / ) value と等しい値を持つ最初の要素をリストから削除します。該当する要素がなければ ValueError を送出しま ...
https://man.mtool.work/python/3.14/tutorial/datastructures.html
unittest.mock --- モックオブジェクトライブラリ 7649
unittest.mock --- モックオブジェクトライブラリ Added in version 3.3. ソースコード: Lib/unittest/mock.py unittest.mock は Python でテストを行うためのライブラリです。 テスト対象のシステムの一部をモックオブジェクトに置き換え、どのように使われた ... ) assert_has_calls ( calls , any_order = False ) assert the mock has been called with the specified calls. The mock_calls list is checked for the calls. any_order が false の場合、呼び出しは連続していなければなりません。指定された呼び出しの前、あるい ... mock . call_args . args (3, 4, 5) >>> mock . call_args . kwargs {'key': 'fish', 'next': 'w00t!'} call_args と、 call_args_list 、 method_calls 、 mock_calls の各リストの要素は call オブジェクトです。 これらはタプルなので、アンパックして個々の引数を取 ... ョンを行えます。 calls as tuples を参照してください。 バージョン 3.8 で変更: args と kwargs 属性が追加されました。 call_args_list モックの呼び出しを順に記録したリストです (よって、このリストの長さはモックが呼び出された回数と等しくなります)。モックを作成 ...
https://man.mtool.work/python/3.14/library/unittest.mock.html
プログラミング FAQ 7584
プログラミング FAQ 一般的な質問 ブレークポイントやステップ実行ができる、ソースコードレベルのデバッガはありますか? はい。 Python 用のデバッガについては次に解説してあり、組み込みの breakpoint() 関数でそれらのデバッガに処理を移せます。 pdb モジ ... unc を呼び出すときには、例えば: func ( 42 , bar = 314 , extra = somevar ) 42 、 314 、 somevar という値は実引数です。 なぜ list 'y' を変更すると list 'x' も変更されるのですか? 次のようなコードを書いたとします: >>> x = [] >>> y = x >>> y . append ( 10 ... る振る舞いをする演算の種類が一つあります: 累算代入演算です。例えば += はリストを変更しますが、タプルや整数は変更しません( a_list += [1, 2, 3] は a_list.extend([1, 2, 3]) と同じ意味で、そして a_list を変更しますが、 some_tuple += (1, 2, 3) と some_int ... += 1 は新しいオブジェクトを作ります)。 言い換えると: mutable オブジェクト ( list , dict , set のような) の場合は、特定の操作を用いてそれを変えることができ、それを参照する どの変数にも その変更が反映されま ...
https://man.mtool.work/python/3.14/faq/programming.html
collections --- コンテナデータ型 7519
collections --- コンテナデータ型 ソースコード: Lib/collections/__init__.py このモジュールは、汎用の Python 組み込みコンテナ dict , list , set , および tuple に代わる、特殊なコンテナデータ型を実装しています。 namedtuple() 名前付きフィールドを ... リ関数を呼び出して存在しない値を供給する辞書のサブクラス UserDict 辞書のサブクラス化を簡単にする辞書オブジェクトのラッパ UserList リストのサブクラス化を簡単にするリストオブジェクトのラッパ UserString 文字列のサブクラス化を簡単にする文字列オブジェクトの ... >> baseline = { 'music' : 'bach' , 'art' : 'rembrandt' } >>> adjustments = { 'art' : 'van gogh' , 'opera' : 'carmen' } >>> list ( ChainMap ( adjustments , baseline )) ['music', 'art', 'opera'] これは、末尾のマッピングオブジェクトから始めた一連の dict ... .update() の呼び出しと同じ順序になります。 >>> combined = baseline . copy () >>> combined . update ( adjustments ) >>> list ( combined ) ['music', 'art', 'opera'] バージョン 3.9 で変更: PEP 584 で規定されている | 演算子と |= 演算子のサポートを追加 ...
https://man.mtool.work/python/3.14/library/collections.html
unittest.mock --- 入門 7377
unittest.mock --- 入門 Added in version 3.3. Mock を使う モックでメソッドにパッチを当てる 一般的な Mock の使い方の中には次のものがあります: メソッドにパッチを当てる オブジェクトに対するメソッド呼び出しを記録する システムの他の部分からメソッ ... . cursor () . execute ( "SELECT 1" ) ['foo'] >>> expected = call . connection . cursor () . execute ( "SELECT 1" ) . call_list () >>> mock . mock_calls [call.connection.cursor(), call.connection.cursor().execute('SELECT 1')] >>> mock . mock_calls == ... expected True call object を chained call を表す list にするために .call_list() を使います。 モックから例外を発生させる side_effect という便利な属性があります。この属性に例外ク ... 出しは、1行のコードの中で行われる複数の呼び出しです。したがって、 mock_calls には複数のエントリーがあるでしょう。 call.call_list() を使用することで、この呼び出しのリストを作成することができます: >>> chained = call . get_endpoint ( 'foobar' ) . create_ ...
https://man.mtool.work/python/3.14/library/unittest.mock-examples.html
8. 複合文 (compound statement) 7377
8. 複合文 (compound statement) 複合文には、他の文 (のグループ) が入ります; 複合文は、中に入っている他の文の実行の制御に何らかのやり方で影響を及ぼします。一般的には、複合文は複数行にまたがって書かれますが、全部の文を一行に連ねた単純な書き方も ... t | try_stmt | with_stmt | match_stmt | funcdef | classdef | async_with_stmt | async_for_stmt | async_funcdef suite : stmt_list NEWLINE | NEWLINE INDENT statement + DEDENT statement : stmt_list NEWLINE | compound_stmt stmt_list : simple_stmt ( ";" si ... や、その他の反復可能なオブジェクト (iterable object) 内の要素に渡って反復処理を行うために使われます: for_stmt : "for" target_list "in" starred_expression_list ":" suite [ "else" ":" suite ] starred_expression_list の式を一度評価します。 結果は イテラブ ... : 'match' subject_expr ":" NEWLINE INDENT case_block + DEDENT subject_expr : flexible_expression "," [ flexible_expression_list [ ',' ]] | assignment_expression case_block : 'case' patterns [ guard ] ":" suite 注釈 このセクションでは、一重引用符で囲ま ...
https://man.mtool.work/python/3.14/reference/compound_stmts.html
PREV 1 2 3 4 5 6 7 8 9 10 NEXT