Results of 1 - 10 of about 18 for tuples (0.006 sec.)
- ソートのテクニック 14962
- ソートのテクニック Author : Andrew Dalke and Raymond Hettinger Python のリストにはリストをインプレースに変更する、組み込みメソッド list.sort() があります。他にもイテラブルからソートしたリストを作成する組み込み関数 sorted() があります。 この
...方は、複数の要素を持つオブジェクトからインデックスで取り出した値をキーにしてソートすることです。 例を示します。 >>> student_tuples = [ ... ( 'john' , 'A' , 15 ), ... ( 'jane' , 'B' , 12 ), ... ( 'dave' , 'B' , 10 ), ... ] >>> sorted ( student_tuples , k...関数を利用すると、上の例はもっと簡単で高速になります: >>> from operator import itemgetter , attrgetter >>> sorted ( student_tuples , key = itemgetter ( 2 )) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] >>> sorted ( student_objects , key = a...を付けてソートできます。 例えば、まず grade で比較し、同じ場合は age で比較するには、次のようにします。 >>> sorted ( student_tuples , key = itemgetter ( 1 , 2 )) [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)] >>> sorted ( student_objects , key... - https://man.mtool.work/python/3.14/howto/sorting.html
- bdb --- デバッガーフレームワーク 9625
- bdb --- デバッガーフレームワーク ソースコード: Lib/bdb.py bdb モジュールは、ブレークポイントの設定やデバッガーを通じた実行の管理など、デバッガーの基本的な機能を扱います。 以下の例外が定義されています: exception bdb. BdbQuit Bdb クラスが、デ
...Numeric index for a single instance of a Breakpoint . bplist Dictionary of Breakpoint instances indexed by ( file , line ) tuples. ignore Breakpoint を無視する回数です。 hits Breakpoint にヒットした回数です。 class bdb. Bdb ( skip = None , backend = 's...を呼んでスタックトレースを表現するデータ構造を取得することができます。 get_stack ( f , t ) Return a list of (frame, lineno) tuples in a stack trace, and a size. The most recently called frame is last in the list. The size is the number of frames below t... - https://man.mtool.work/python/3.14/library/bdb.html
- unittest.mock --- モックオブジェクトライブラリ 9145
- unittest.mock --- モックオブジェクトライブラリ Added in version 3.3. ソースコード: Lib/unittest/mock.py unittest.mock は Python でテストを行うためのライブラリです。 テスト対象のシステムの一部をモックオブジェクトに置き換え、どのように使われた
...l オブジェクトです。 これらはタプルなので、アンパックして個々の引数を取り出し、より複雑なアサーションを行えます。 calls as tuples を参照してください。 バージョン 3.8 で変更: args と kwargs 属性が追加されました。 call_args_list モックの呼び出しを順に記録...e call_args_list のメンバは call オブジェクトです。タプルとしてアンパックすることで個別に取り出すことができます。 calls as tuples を参照してください。 method_calls 自身の呼び出しと同様に、モックはメソッドや属性、そして それらの メソッドや属性の呼び出し...()] method_calls のメンバは call オブジェクトです。タプルとしてアンパックすることで個別に取り出すことができます。 calls as tuples を参照してください。 mock_calls mock_calls は、メソッド、特殊メソッド、 そして 戻り値のモックまで、モックオブジェクトに対す... - https://man.mtool.work/python/3.14/library/unittest.mock.html
- 5. データ構造 9145
- 5. データ構造 この章では、すでに学んだことについてより詳しく説明するとともに、いくつか新しいことを追加します。 5.1. リスト型についてもう少し list 型には、他にもいくつかメソッドがあります。リストオブジェクトのすべてのメソッドを以下に示します
...ります。例えば以下のように書きます: >>> t = 12345 , 54321 , 'hello!' >>> t [ 0 ] 12345 >>> t (12345, 54321, 'hello!') >>> # Tuples may be nested: >>> u = t , ( 1 , 2 , 3 , 4 , 5 ) >>> u ((12345, 54321, 'hello!'), (1, 2, 3, 4, 5)) >>> # Tuples are immuta...通常は異なる型の要素が並びます。 要素には、アンパック (この節の後半で説明します) やインデックスを使ってアクセスします ( namedtuples では属性でもアクセスできます)。 リストは 可変 で、要素は通常同じ型であり、リストを反復処理してアクセスします。 問題は 0 個... - https://man.mtool.work/python/3.14/tutorial/datastructures.html
- タプルオブジェクト (tuple object) 8647
- タプルオブジェクト (tuple object) type PyTupleObject この PyObject のサブタイプは Python のタプルオブジェクトを表現します。 PyTypeObject PyTuple_Type 次に属します: Stable ABI . この PyTypeObject のインスタンスは Python のタプル型を表現します
...e_t pos , PyObject * o ) Like PyTuple_SetItem() , but does no error checking, and should only be used to fill in brand new tuples. Python を デバッグモード または アサーションを有効にして ビルドした場合、アサーションによる境界チェックが行われます。 注釈... - https://man.mtool.work/python/3.14/c-api/tuple.html
- デザインと歴史 FAQ 8647
- デザインと歴史 FAQ Python はなぜ文のグループ化にインデントを使うのですか? Guido van Rossum の信じるところによれば、インデントによるグループ化は非常にエレガントで、普通の Python プログラムを大いに読みやすくします。しばらくすればほとんどの人は
...の文字列表現のリストを返します。この出力を演算する関数は一般に、ディレクトリに一つや二つの別のファイルを加えても壊れません。 Tuples are immutable, meaning that once a tuple has been created, you can't replace any of its elements with a new value. Lists a...aning that you can always change a list's elements. Only immutable elements can be used as dictionary keys, and hence only tuples and not lists can be used as keys. CPythonでリストはどのように実装されているのですか? CPython のリストは可変長配列で、Lisp... - https://man.mtool.work/python/3.14/faq/design.html
- dataclasses --- データクラス 8647
- dataclasses --- データクラス ソースコード: Lib/dataclasses.py このモジュールは、 __init__() や __repr__() のような 特殊メソッド を生成し、ユーザー定義のクラスに自動的に追加するデコレーターや関数を提供します。このモジュールは元々、 PEP 557 で
...dict_factory ). Each dataclass is converted to a dict of its fields, as name: value pairs. dataclasses, dicts, lists, and tuples are recursed into. Other objects are copied with copy.deepcopy() . 入れ子になったデータクラスに asdict() を使用する例です。...ctory function tuple_factory ). Each dataclass is converted to a tuple of its field values. dataclasses, dicts, lists, and tuples are recursed into. Other objects are copied with copy.deepcopy() . 1つ前の例の続きです: assert astuple ( p ) == ( 10 , 20... - https://man.mtool.work/python/3.14/library/dataclasses.html
- email.utils: 各種ユーティリティ 8647
- email.utils : 各種ユーティリティ ソースコード: Lib/email/utils.py email.utils モジュールには、いくつかの便利なユーティリティがあります: email.utils. localtime ( dt = None ) Return local time as an aware datetime object. If called without ar
...オプションが追加されました。 email.utils. getaddresses ( fieldvalues , * , strict = True ) This function returns a list of 2-tuples of the form returned by parseaddr() . fieldvalues is a sequence of header field values as might be returned by Message.get... - https://man.mtool.work/python/3.14/library/email.utils.html
- tokenize --- Python ソース用のトークナイザー 8647
- tokenize --- Python ソース用のトークナイザー ソースコード: Lib/tokenize.py The tokenize module provides a lexical scanner for Python source code, implemented in Python. The scanner in this module returns comments as tokens as well, making i
...せん。 The generator produces TokenInfo objects. バージョン 3.1 で変更: Changed to yield TokenInfo objects instead of plain tuples. tokenize() は PEP 263 にしたがって、ソースのエンコーディングを UTF-8 BOM か encoding cookie を見つけて決定します。 tokeni... - https://man.mtool.work/python/3.14/library/tokenize.html
- 6. 式 (expression) 8167
- 6. 式 (expression) この章では、Python の式における個々の要素の意味について解説します。 構文上の注意: この章以降では、 文法の表記法 を字句解析ではなく構文の記述に使います。 構文規則の (選択肢の 1 つの) 形式が次のように記述され、 name : other
...the single expression that makes up the expression list. An empty pair of parentheses yields an empty tuple object. Since tuples are immutable, the same rules as for literals apply (i.e., two occurrences of the empty tuple may or may not yield the sam...e object). Note that tuples are not formed by the parentheses, but rather by use of the comma. The exception is the empty tuple, for which parentheses... - https://man.mtool.work/python/3.14/reference/expressions.html