Results of 1 - 10 of about 22 for itemgetter (0.006 sec.)
- operator --- 関数形式の標準演算子 — Python 3.14.8 ドキュメント 12676
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » operator --- 関数形式の標準演算子 テーマ 自動 ライト ダーク | operator --- 関数形式の標準演算子
...urn g def resolve_attr ( obj , attr ): for name in attr . split ( "." ): obj = getattr ( obj , name ) return obj operator. itemgetter ( item ) ¶ operator. itemgetter ( * items ) 演算対象からその __getitem__() メソッドを使って item を取得する呼び出し可能なオ...ブジェクトを返します。 二つ以上のアイテムを要求された場合には、アイテムのタプルを返します。例えば: f = itemgetter(2) とした後で、 f(r) を呼び出すと r[2] を返します。 g = itemgetter(2, 5, 3) とした後で、 g(r) を呼び出すと (r[2], r[5], r[...3]) を返します。 次と等価です: def itemgetter ( * items ): if len ( items ) == 1 : item = items [ 0 ] def g ( obj ): return obj [ item ] else : def g ( obj ): return tu... - https://man.mtool.work/python/3.14/library/operator.html
- operator --- 関数形式の標準演算子 — Python 3.14.8 ドキュメント 12676
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » operator --- 関数形式の標準演算子 テーマ 自動 ライト ダーク | operator --- 関数形式の標準演算子
...urn g def resolve_attr ( obj , attr ): for name in attr . split ( "." ): obj = getattr ( obj , name ) return obj operator. itemgetter ( item ) ¶ operator. itemgetter ( * items ) 演算対象からその __getitem__() メソッドを使って item を取得する呼び出し可能なオ...ブジェクトを返します。 二つ以上のアイテムを要求された場合には、アイテムのタプルを返します。例えば: f = itemgetter(2) とした後で、 f(r) を呼び出すと r[2] を返します。 g = itemgetter(2, 5, 3) とした後で、 g(r) を呼び出すと (r[2], r[5], r[...3]) を返します。 次と等価です: def itemgetter ( * items ): if len ( items ) == 1 : item = items [ 0 ] def g ( obj ): return obj [ item ] else : def g ( obj ): return tu... - https://man.mtool.work/python/3.14/library/operator.html
- ソートのテクニック — Python 3.14.8 ドキュメント 11262
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » ソートのテクニック テーマ 自動 ライト ダーク | ソートのテクニック ¶ Author : Andrew Dalke and Raymond Hettinger Python のリストにはリストをインプレ
...on パターンは非常に一般的なので、Python はアクセサ関数を簡単に速く作れる便利な関数を提供しています。 operator モジュールに itemgetter() 、 attrgetter() 、および methodcaller() 関数があります。 これらの関数を利用すると、上の例はもっと簡単で高速になります: >...>> from operator import itemgetter , attrgetter >>> sorted ( student_tuples , key = itemgetter ( 2 )) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15...の段階でのソートを可能にします。例えば、 grade でソートしてさらに age でソートする場合: >>> sorted ( student_tuples , key = itemgetter ( 1 , 2 )) [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)] >>> sorted ( student_objects , key = attrgetter ( 'gr... - https://man.mtool.work/python/3.14/howto/sorting.html
- ソートのテクニック — Python 3.14.8 ドキュメント 10757
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » ソートのテクニック テーマ 自動 ライト ダーク | ソートのテクニック ¶ Author : Andrew Dalke and Raymond Hettinger Python のリストにはリストをインプレ
...on パターンは非常に一般的なので、Python はアクセサ関数を簡単に速く作れる便利な関数を提供しています。 operator モジュールに itemgetter() 、 attrgetter() 、および methodcaller() 関数があります。 これらの関数を利用すると、上の例はもっと簡単で高速になります: >...>> from operator import itemgetter , attrgetter >>> sorted ( student_tuples , key = itemgetter ( 2 )) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15...の段階でのソートを可能にします。例えば、 grade でソートしてさらに age でソートする場合: >>> sorted ( student_tuples , key = itemgetter ( 1 , 2 )) [('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)] >>> sorted ( student_objects , key = attrgetter ( 'gr... - https://man.mtool.work/python/3.14/howto/sorting.html
- itertools --- 効率的なループ用のイテレータ生成関数群 — Python 3.14.8 ドキュメン... 8181
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » itertools --- 効率的なループ用のイテレータ生成関数群 テーマ 自動 ライト ダーク | itertools --- 効
...op , heappush_max , heappushpop_max from math import comb , isqrt , prod , sumprod from operator import getitem , is_not , itemgetter , mul , neg , truediv # ==== Basic one liners ==== def take ( n , iterable ): "Return first n items of the iterable as a l...seen('AAAABBBCCDAABBB') → A B C D A B # unique_justseen('ABBcCAD', str.casefold) → A B c A D if key is None : return map ( itemgetter ( 0 ), groupby ( iterable )) return map ( next , map ( itemgetter ( 1 ), groupby ( iterable , key ))) def unique_everseen... - https://man.mtool.work/python/3.14/library/itertools.html
- What's New in Python 2.4 — Python 3.14.8 ドキュメント 8181
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New in Python 2.4 テーマ 自動 ライト ダーク | What's New in Python 2.4 ¶ 著者 : A.M. Kuchling この文書は 2005 年 3 月 30 日にリリー
...le group or for a range of groups. (Contributed by Jürgen A. Erhard.) operator モジュールに 2 つの関数 attrgetter(attr) と itemgetter(index) が追加されています。両関数ともに、単一引数を取ってそれに対応する属性かアイテムを返す呼び出し可能オブジェクトを返しま...際の優れたデータ抽出器になります。例えば: >>> L = [( 'c' , 2 ), ( 'd' , 1 ), ( 'a' , 4 ), ( 'b' , 3 )] >>> map ( operator . itemgetter ( 0 ), L ) ['c', 'd', 'a', 'b'] >>> map ( operator . itemgetter ( 1 ), L ) [2, 1, 4, 3] >>> sorted ( L , key = operator .... - https://man.mtool.work/python/3.14/whatsnew/2.4.html
- itertools --- 効率的なループ用のイテレータ生成関数群 — Python 3.14.8 ドキュメン... 8181
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » itertools --- 効率的なループ用のイテレータ生成関数群 テーマ 自動 ライト ダーク | itertools --- 効
...op , heappush_max , heappushpop_max from math import comb , isqrt , prod , sumprod from operator import getitem , is_not , itemgetter , mul , neg , truediv # ==== Basic one liners ==== def take ( n , iterable ): "Return first n items of the iterable as a l...seen('AAAABBBCCDAABBB') → A B C D A B # unique_justseen('ABBcCAD', str.casefold) → A B c A D if key is None : return map ( itemgetter ( 0 ), groupby ( iterable )) return map ( next , map ( itemgetter ( 1 ), groupby ( iterable , key ))) def unique_everseen... - https://man.mtool.work/python/3.14/library/itertools.html
- What's New in Python 2.4 — Python 3.14.8 ドキュメント 8181
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New in Python 2.4 テーマ 自動 ライト ダーク | What's New in Python 2.4 ¶ 著者 : A.M. Kuchling この文書は 2005 年 3 月 30 日にリリー
...le group or for a range of groups. (Contributed by Jürgen A. Erhard.) operator モジュールに 2 つの関数 attrgetter(attr) と itemgetter(index) が追加されています。両関数ともに、単一引数を取ってそれに対応する属性かアイテムを返す呼び出し可能オブジェクトを返しま...際の優れたデータ抽出器になります。例えば: >>> L = [( 'c' , 2 ), ( 'd' , 1 ), ( 'a' , 4 ), ( 'b' , 3 )] >>> map ( operator . itemgetter ( 0 ), L ) ['c', 'd', 'a', 'b'] >>> map ( operator . itemgetter ( 1 ), L ) [2, 1, 4, 3] >>> sorted ( L , key = operator .... - https://man.mtool.work/python/3.14/whatsnew/2.4.html
- bisect --- 配列二分法アルゴリズム — Python 3.14.8 ドキュメント 7794
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » データ型 » bisect --- 配列二分法アルゴリズム テーマ 自動 ライト ダーク | bisect --- 配列二分法アルゴリズム ¶ ソースコード: Lib/bise
...d' , 5 ), ( 'blue' , 1 ), ( 'yellow' , 8 ), ( 'black' , 0 )] >>> data . sort ( key = lambda r : r [ 1 ]) # Or use operator.itemgetter(1). >>> keys = [ r [ 1 ] for r in data ] # Precompute a list of keys. >>> data [ bisect_left ( keys , 0 )] ('black', 0) >>... - https://man.mtool.work/python/3.14/library/bisect.html
- bisect --- 配列二分法アルゴリズム — Python 3.14.8 ドキュメント 7794
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » データ型 » bisect --- 配列二分法アルゴリズム テーマ 自動 ライト ダーク | bisect --- 配列二分法アルゴリズム ¶ ソースコード: Lib/bise
...d' , 5 ), ( 'blue' , 1 ), ( 'yellow' , 8 ), ( 'black' , 0 )] >>> data . sort ( key = lambda r : r [ 1 ]) # Or use operator.itemgetter(1). >>> keys = [ r [ 1 ] for r in data ] # Precompute a list of keys. >>> data [ bisect_left ( keys , 0 )] ('black', 0) >>... - https://man.mtool.work/python/3.14/library/bisect.html