Results of 1 - 9 of about 9 for accumulate (0.011 sec.)
- itertools --- 効率的なループ用のイテレータ生成関数群 13948
- itertools --- 効率的なループ用のイテレータ生成関数群 このモジュールは イテレータ を構築する部品を実装しています。プログラム言語 APL, Haskell, SML からアイデアを得ていますが、 Python に適した形に修正されています。 このモジュールは、高速でメモ
...thon では map() と count() を組合せて map(f, count()) という形で実現できます。 汎用イテレータ: イテレータ 引数 結果 使用例 accumulate() p [,func] p0, p0+p1, p0+p1+p2, ... accumulate([1,2,3,4,5]) → 1 3 6 10 15 batched() p, n (p0, p1, ..., p_n-1), ... batche...長のストリームを提供するものもあるので、その場合はストリームを途中で打ち切る関数やループでのみ使用してください。 itertools. accumulate ( iterable [ , function , * , initial=None ] ) 累積和、または他の 2 引数関数による累積結果を返すイテレータを作成します。 f...ます。 initial を指定すると、その値から累積を開始し、出力は入力のイテラブルより 1 要素多くなります。 およそ次と等価です: def accumulate ( iterable , function = operator . add , * , initial = None ): '累積値を返す' # accumulate([1,2,3,4,5]) → 1 3 6 10 15 # ac... - https://man.mtool.work/python/3.14/library/itertools.html
- What's New In Python 3.2 9059
- What's New In Python 3.2 著者 : Raymond Hettinger この記事では Python 3.1 と比較した Python 3.2 の新機能を説明します。 Python 3.2 は 2011 年 2 月 20 日にリリースされました。 主な変更点をいくつか取り上げ、例を示します。 すべての詳細については
...To を参照して下さい。 (Contributed by Raymond Hettinger.) itertools itertools モジュールに、 APL の scan 演算子や NumPy の accumulate 関数をモデルにした accumulate() が新しく追加されました: >>> from itertools import accumulate >>> list ( accumulate ([ 8 ,...2 , 50 ])) [8, 10, 60] >>> prob_dist = [ 0.1 , 0.4 , 0.2 , 0.3 ] >>> list ( accumulate ( prob_dist )) # cumulative probability distribution [0.1, 0.5, 0.7, 1.0] accumulate() の使用例が examples for the random... - https://man.mtool.work/python/3.14/whatsnew/3.2.html
- 関数型プログラミング HOWTO 8879
- 関数型プログラミング HOWTO Author : A. M. Kuchling Release : 0.32 この文書では、関数型スタイルでプログラムを実装するのにピッタリな Python の機能を見てまわることにしましょう。まず関数型プログラミングという概念を紹介したあと、 iterator や gen
...perator . mul , [ 1 , 2 , 3 ], 1 ) # こう書ける: product = 1 for i in [ 1 , 2 , 3 ]: product *= i 関連する関数に itertools.accumulate(iterable, func=operator.add) があります。 同じ計算を行いますが、 accumulate() は最終結果だけを返すのではなく、途中の結果も...順に生成するイテレータを返します。 itertools . accumulate ([ 1 , 2 , 3 , 4 , 5 ]) => 1 , 3 , 6 , 10 , 15 itertools . accumulate ([ 1 , 2 , 3 , 4 , 5 ], operator . mul ) => 1 , 2 ,... - https://man.mtool.work/python/3.14/howto/functional.html
- argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー 8358
- argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー Added in version 3.2. ソースコード: Lib/argparse.py 注釈 argparse は基本的なコマンドラインアプリケーションの実装に推奨される標準ライブラリのモジュールですが、動作を厳密
...range ( 10 ), ... nargs = '+' , help = 'an integer in the range 0..9' ) >>> parser . add_argument ( ... '--sum' , dest = 'accumulate' , action = 'store_const' , const = sum , ... default = max , help = 'sum the integers (default: find the max)' ) >>> pars...er . parse_args ([ '1' , '2' , '3' , '4' ]) Namespace(accumulate=<built-in function max>, integers=[1, 2, 3, 4]) >>> parser . parse_args ([ '1' , '2' , '3' , '4' , '--sum' ]) Namespace(ac... - https://man.mtool.work/python/3.14/library/argparse.html
- What's New In Python 3.3 8358
- What's New In Python 3.3 この記事では 3.2 と比較した Python 3.3 の新機能を解説します。 Python 3.3 は2012年9月29日にリリースされました。全詳細については 変更履歴 をご覧ください。 参考 PEP 398 - Python 3.3 リリーススケジュール 概要 -- リリース
...コープから send() されたり throw() された値を直接受け取ることができ、また、外側のジェネレータに最終的な値を返せます: >>> def accumulate (): ... tally = 0 ... while 1 : ... next = yield ... if next is None : ... return tally ... tally += next ... >>> def gath...er_tallies ( tallies ): ... while 1 : ... tally = yield from accumulate () ... tallies . append ( tally ) ... >>> tallies = [] >>> acc = gather_tallies ( tallies ) >>> next ( acc ) # アキュムレー...が保証されます。 TextIOWrapper オブジェクトに書き込んだデータは、すべて直ちに下位のバイナリバッファに渡されます。 itertools accumulate() がユーザ提供二項関数を渡すためのオプショナル引数 func を受け付けるようになりました。 logging basicConfig() 関数がオプショ... - https://man.mtool.work/python/3.14/whatsnew/3.3.html
- What's New In Python 3.8 8358
- What's New In Python 3.8 編集者 : Raymond Hettinger この記事では Python 3.7 と比較した Python 3.8 の新機能を解説します。 Python 3.8 は 2019 年 10 月 14 日にリリースされました。 詳しくは 変更履歴 を参照してください。 概要 -- リリースハイライ
...eption is ignored silently by default in release build. (Contributed by Victor Stinner in bpo-18748 .) itertools itertools.accumulate() 関数に、初期値を定める、オプションの initial キーワード引数が追加されました: >>> from itertools import accumulate >>> li...st ( accumulate ([ 10 , 5 , 30 , 15 ], initial = 1000 )) [1000, 1010, 1015, 1045, 1060] (Lisa Roach の貢献による bpo-34659 ) json.tool 一行... - https://man.mtool.work/python/3.14/whatsnew/3.8.html
- functools --- 高階関数と呼び出し可能オブジェクトの操作 7998
- functools --- 高階関数と呼び出し可能オブジェクトの操作 ソースコード: Lib/functools.py functools モジュールは、ほかの関数を操作したり返したりする高階関数のためのモジュールです。 一般に、このモジュールではあらゆる呼び出し可能オブジェクトを関数
...ial for element in it : value = function ( value , element ) return value 全ての中間値を返すイテレータについては itertools.accumulate() を参照してください。 バージョン 3.14 で変更: initial をキーワード引数として指定できるようになりました。 @ functools. sin... - https://man.mtool.work/python/3.14/library/functools.html
- random --- 疑似乱数を生成する 7998
- random --- 疑似乱数を生成する ソースコード: Lib/random.py このモジュールでは様々な分布をもつ擬似乱数生成器を実装しています。 整数用に、ある範囲からの一様な選択があります。 シーケンス用には、シーケンスからのランダムな要素の一様な選択、リスト
...た場合、相対的な重みに基づいて要素が選ばれます。あるいは、 cum_weights シーケンスが与えられた場合、累積的な重み ( itertools.accumulate() を用いて計算されるかもしれません) で要素が選ばれます。例えば、相対的な重み [10, 5, 30, 5] は累積的な重み [10, 15, 45, 50... - https://man.mtool.work/python/3.14/library/random.html
- 変更履歴 7837
- 変更履歴 次の 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
...LS 1.2 renegotiation alerts). Reading from the peer is now paused when this output accumulates, instead of only when application data does. gh-160420 : Fix zoneinfo.ZoneInfo on Windows accepting keys in which a compo...うになり、 serve_forever() はすみやかに終了して、ハンドラーは EOF を受け取ります。 gh-123471 : フリースレッドでの itertools.accumulate の並行した反復を安全にしました。 gh-123471 : フリースレッドでの itertools.combinations_with_replacement と itertools.permu... - https://man.mtool.work/python/3.14/whatsnew/changelog.html
PREV
1
NEXT