per page, with , order by , clip by
Results of 1 - 8 of about 8 for combinations (0.009 sec.)
itertools --- 効率的なループ用のイテレータ生成関数群 13700
itertools --- 効率的なループ用のイテレータ生成関数群 このモジュールは イテレータ を構築する部品を実装しています。プログラム言語 APL, Haskell, SML からアイデアを得ていますが、 Python に適した形に修正されています。 このモジュールは、高速でメモ ... ) p, q, ... [repeat=1] デカルト積、ネストしたforループと等価 permutations() p[, r] 長さrのタプル列、重複なしのあらゆる並び combinations() p, r 長さrのタプル列、ソートされた順で重複なし combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複 ... CD', repeat=2) AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD permutations('ABCD', 2) AB AC AD BA BC BD CA CB CD DA DB DC combinations('ABCD', 2) AB AC AD BC BD CD combinations_with_replacement('ABCD', 2) AA AB AC AD BB BC BD CC CD DD Itertool関数 次の関数は ... terables ): # chain.from_iterable(['ABC', 'DEF']) → A B C D E F for iterable in iterables : yield from iterable itertools. combinations ( iterable , r ) 入力 iterable の要素からなる長さ r の部分列を返します。 出力は product() の部分列であり、 iterable の部分 ...
https://man.mtool.work/python/3.14/library/itertools.html
関数型プログラミング HOWTO 9199
関数型プログラミング HOWTO Author : A. M. Kuchling Release : 0.32 この文書では、関数型スタイルでプログラムを実装するのにピッタリな Python の機能を見てまわることにしましょう。まず関数型プログラミングという概念を紹介したあと、 iterator や gen ... す。 itertools . compress ([ 1 , 2 , 3 , 4 , 5 ], [ True , True , False , False , True ]) => 1 , 2 , 5 組合せ関数 itertools.combinations(iterable, r) は、 iterable 内の要素から r 個を選ぶすべての組み合わせを、タプルとして返すイテレータを作ります。 itertools . ... combinations ([ 1 , 2 , 3 , 4 , 5 ], 2 ) => ( 1 , 2 ), ( 1 , 3 ), ( 1 , 4 ), ( 1 , 5 ), ( 2 , 3 ), ( 2 , 4 ), ( 2 , 5 ), ( 3 , 4 ), ( 3 ... , 5 ), ( 4 , 5 ) itertools . combinations ([ 1 , 2 , 3 , 4 , 5 ], 3 ) => ( 1 , 2 , 3 ), ( 1 , 2 , 4 ), ( 1 , 2 , 5 ), ( 1 , 3 , 4 ), ( 1 , 3 , 5 ), ( 1 , 4 , 5 ), ( ...
https://man.mtool.work/python/3.14/howto/functional.html
random --- 疑似乱数を生成する 8386
random --- 疑似乱数を生成する ソースコード: Lib/random.py このモジュールでは様々な分布をもつ擬似乱数生成器を実装しています。 整数用に、ある範囲からの一様な選択があります。 シーケンス用には、シーケンスからのランダムな要素の一様な選択、リスト ... e r return tuple ( random . sample ( pool , r )) def random_combination ( iterable , r ): "次からランダムに選択: itertools.combinations(iterable, r)" pool = tuple ( iterable ) n = len ( pool ) indices = sorted ( random . sample ( range ( n ), r )) return tup ... t ( iterable , r ): """復元抽出で r 個の要素を選ぶ。 結果は iterable 内の順序に合わせて並べる。 """ # 結果は set(itertools.combinations_with_replacement(iterable, r)) に含まれる。 pool = tuple ( iterable ) n = len ( pool ) indices = sorted ( random . choices ...
https://man.mtool.work/python/3.14/library/random.html
What's New in Python 2.6 8386
What's New in Python 2.6 著者 : A.M. Kuchling (amk at amk.ca) この記事では、2008 年 10 月 1 日にリリースされた Python 2.6 の新機能を説明します。 リリース日程は PEP 361 に記載されています。 Python 2.6 の主要なテーマは、言語を大幅に再設計する ... 4, 2, 4), (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4), (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)] combinations(iterable, r) は、入力 iterable の要素からなる長さ r の部分列を返します (---訳注: 数学の初等組み合わせ論の「組合せ (combina ... tion)」 ---): >>> list ( itertools . combinations ( '123' , 2 )) [('1', '2'), ('1', '3'), ('2', '3')] >>> list ( itertools . combinations ( '123' , 3 )) [('1', '2', '3')] > ... >> list ( itertools . combinations ( '1234' , 3 )) [('1', '2', '3'), ('1', '2', '4'), ('1', '3', '4'), ('2', '3', '4')] permutations(iter[, r]) は入力 iterab ...
https://man.mtool.work/python/3.14/whatsnew/2.6.html
What's New in Python 2.7 8386
What's New in Python 2.7 著者 : A.M. Kuchling (amk at amk.ca) この文書は Python 2.7 の新機能について解説します。Python 2.7 は 2010 年 7 月 3 日にリリースされました。 数値周りの扱いが、浮動小数点数でも Decimal クラスでもいろいろな点で改良され ... が真であれば返されます: itertools . compress ( 'ABCDEF' , [ 1 , 0 , 1 , 0 , 1 , 1 ]) => A , C , E , F 新しい関数: itertools.combinations_with_replacement(iter, r) は、 iter から、すべての可能な長さ r の要素の組合せを返します。 combinations() とは異なり、生成さ ... れた組合せに個別の要素が繰り返し出現できます: itertools . combinations_with_replacement ( 'abc' , 2 ) => ( 'a' , 'a' ), ( 'a' , 'b' ), ( 'a' , 'c' ), ( 'b' , 'b' ), ( 'b' , 'c' ), ( 'c' , 'c' ) ... Decimal インスタンスのような、非整数の値を使えるようになりました。(Implemented by Raymond Hettinger; bpo-5032 .) itertools.combinations() および itertools.product() は、以前は入力のイテレート可能オブジェクトより大きい r に ValueError を返していました。これは ...
https://man.mtool.work/python/3.14/whatsnew/2.7.html
What's New In Python 3.1 8386
What's New In Python 3.1 著者 : Raymond Hettinger この記事では Python 3.0 と比較した Python 3.1 の新機能を説明します。 Python 3.1 は 2009 年 6 月 27 日にリリースされました。 PEP 372: 順序付き辞書 通常の Python 辞書は、 key/value ペアを不定の ... になっています。 (Contributed by Raymond Hettinger and Mark Dickinson.) itertools に 2 つの関数が追加されました。 itertools.combinations_with_replacement() 関数は、置換 (順列, permutation) や直積 (Cartesian product) を含む組合せ論の 4 つの生成関数のうちの 1 つ ... 、そして数え方に fractions.Fraction や decimal.Decimal を含む任意の数値型を使えるようになりました。 >>> [ p + q for p , q in combinations_with_replacement ( 'LOVE' , 2 )] ['LL', 'LO', 'LV', 'LE', 'OO', 'OV', 'OE', 'VV', 'VE', 'EE'] >>> list ( compress ( data = ...
https://man.mtool.work/python/3.14/whatsnew/3.1.html
collections --- コンテナデータ型 7988
collections --- コンテナデータ型 ソースコード: Lib/collections/__init__.py このモジュールは、汎用の Python 組み込みコンテナ dict , list , set , および tuple に代わる、特殊なコンテナデータ型を実装しています。 namedtuple() 名前付きフィールドを ... 19 を参照してください。 与えられた要素の集まりからなる与えられた大きさの相違なる多重集合をすべて数え上げるには、 itertools.combinations_with_replacement() を参照してください: map ( Counter , combinations_with_replacement ( 'ABC' , 2 )) # --> AA AB AC BB BC C ...
https://man.mtool.work/python/3.14/library/collections.html
変更履歴 7772
変更履歴 次の Python バージョン リリース日: XXXX-XX-XX セキュリティ gh-160499 : Fix unbounded memory growth in asyncio TLS connections when a peer stops reading but keeps sending records that make OpenSSL generate its own replies (such as T ... 123471 : フリースレッドでの itertools.accumulate の並行した反復を安全にしました。 gh-123471 : フリースレッドでの itertools.combinations_with_replacement と itertools.permutations の並行した反復を安全にしました。 gh-143988 : バッファーのシーケンスが並行して変 ... 71 : フリースレッド で itertools.chain を同時に反復処理しても安全なようにしました。 gh-123471 : フリースレッドで itertools.combinations と itertools.product を同時に反復処理しても安全なようにしました。 gh-123471 : フリースレッドで itertools.cycle を同時に反復 ...
https://man.mtool.work/python/3.14/whatsnew/changelog.html
PREV 1 NEXT