per page, with , order by , clip by
Results of 1 - 10 of about 16 for pool (0.011 sec.)
multiprocessing --- プロセスベースの並列処理 14088
multiprocessing --- プロセスベースの並列処理 ソースコード: Lib/multiprocessing/ 利用可能な環境 : not Android, not iOS, not WASI. このモジュールは モバイルプラットフォーム と WebAssemblyプラットフォーム をサポートしません。 はじめに multipro ... シンに搭載された複数のプロセッサーを十分に活用できます。 POSIX と Windows の両方で動作します。 multiprocessing モジュールは Pool オブジェクトも提供します。 これは、入力データをプロセス間に分配し、複数の入力値に対する関数の実行を並列化する (データ並列処 ... 手段です。 次の例では、子プロセスがモジュールをインポートできるように、その中に関数を定義するという一般的な方法を示します。 Pool を使ったデータ並列処理の基本的な例です。 from multiprocessing import Pool def f ( x ): return x * x if __name__ == '__main ... __' : with Pool ( 5 ) as p : print ( p . map ( f , [ 1 , 2 , 3 ])) 標準出力に以下が出力されます: [ 1 , 4 , 9 ] multiprocessing モジュールに ...
https://man.mtool.work/python/3.14/library/multiprocessing.html
itertools --- 効率的なループ用のイテレータ生成関数群 11436
itertools --- 効率的なループ用のイテレータ生成関数群 このモジュールは イテレータ を構築する部品を実装しています。プログラム言語 APL, Haskell, SML からアイデアを得ていますが、 Python に適した形に修正されています。 このモジュールは、高速でメモ ... combinations ( iterable , r ): # combinations('ABCD', 2) → AB AC AD BC BD CD # combinations(range(4), 3) → 012 013 023 123 pool = tuple ( iterable ) n = len ( pool ) if r > n : return indices = list ( range ( r )) yield tuple ( pool [ i ] for i in in ... : break else : return indices [ i ] += 1 for j in range ( i + 1 , r ): indices [ j ] = indices [ j - 1 ] + 1 yield tuple ( pool [ i ] for i in indices ) itertools. combinations_with_replacement ( iterable , r ) 入力 iterable から、それぞれの要素が複数 ... 等価です: def combinations_with_replacement ( iterable , r ): # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC pool = tuple ( iterable ) n = len ( pool ) if not n and r : return indices = [ 0 ] * r yield tuple ( pool [ i ] for i in indice ...
https://man.mtool.work/python/3.14/library/itertools.html
random --- 疑似乱数を生成する 9998
random --- 疑似乱数を生成する ソースコード: Lib/random.py このモジュールでは様々な分布をもつ擬似乱数生成器を実装しています。 整数用に、ある範囲からの一様な選択があります。 シーケンス用には、シーケンスからのランダムな要素の一様な選択、リスト ... ndom def random_product ( * iterables , repeat = 1 ): "次からランダムに選択: itertools.product(*iterables, repeat=repeat)" pools = tuple ( map ( tuple , iterables )) * repeat return tuple ( map ( random . choice , pools )) def random_permutation ( it ... erable , r = None ): "次からランダムに選択: itertools.permutations(iterable, r)" pool = tuple ( iterable ) r = len ( pool ) if r is None else r return tuple ( random . sample ( pool , r )) def random_combinat ... ion ( iterable , r ): "次からランダムに選択: itertools.combinations(iterable, r)" pool = tuple ( iterable ) n = len ( pool ) indices = sorted ( random . sample ( range ( n ), r )) return tuple ( pool [ i ] for ...
https://man.mtool.work/python/3.14/library/random.html
イベントループ 9114
イベントループ ソースコード: Lib/asyncio/events.py , Lib/asyncio/base_events.py まえがき イベントループは全ての asyncio アプリケーションの中核をなす存在です。イベントループは非同期タスクやコールバックを実行し、ネットワーク I/O を処理し、サブ ... version 3.6. async loop. shutdown_default_executor ( timeout = None ) デフォルトの Executor の終了をスケジュールし、 ThreadPoolExecutor のすべてのスレッドの終了を待ちます。 このメソッドを呼び出した後で loop.run_in_executor() によりデフォルトの Execut ... p.set_default_executor() で設定できます。 設定しなければ、 run_in_executor() が必要になった時点で concurrent.futures.ThreadPoolExecutor を初期化して使います。 以下はプログラム例です: import asyncio import concurrent.futures def blocking_io (): # ログ ... ープのデフォルトの Executor で実行する: result = await loop . run_in_executor ( None , blocking_io ) print ( 'default thread pool' , result ) # 2. 自分で作成したスレッドプールで実行する: with concurrent . futures . ThreadPoolExecutor () as pool : resul ...
https://man.mtool.work/python/3.14/library/asyncio-eventloop.html
What's New in Python 2.6 8335
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 の主要なテーマは、言語を大幅に再設計する ... に使うことが出来ます。(プロセス作成後に親がグローバル変数 queue を差し替えても、子の値は左右されませんし、逆もしかりです。) Pool と Manager は、より高水準のインターフェースを提供します。 Pool は一定数のワーカープロセスを作成します。 apply() や apply_a ... sync() で 1 件、 map() や map_async() で複数の要求を追加して、ワーカーへ処理を分配できます。 次のコードは Pool を使って 5 個のワーカープロセスへ要求を分配し、結果のリストを取得します。 from multiprocessing import Pool def factorial ( ... N , dictionary ): "Compute a factorial." ... p = Pool ( 5 ) result = p . map ( factorial , range ( 1 , 1000 , 10 )) for v in result : print v これは以下のような出力をします: 1 ...
https://man.mtool.work/python/3.14/whatsnew/2.6.html
asyncio とフリースレッド Python 8005
asyncio とフリースレッド Python asyncio uses an event loop as a scheduler to enable highly efficient concurrency by switching between tasks to allow non-blocking I/O operations. This results in better performance for I/O-bound use cases. It ... also allows off-loading CPU-bound work to a thread or process pool, but that is still limited by the global interpreter lock in CPython. 一方、 フリースレッド Python では GIL が無効になり、 ...
https://man.mtool.work/python/3.14/library/asyncio-threading.html
What's New In Python 3.3 8005
What's New In Python 3.3 この記事では 3.2 と比較した Python 3.3 の新機能を解説します。 Python 3.3 は2012年9月29日にリリースされました。全詳細については 変更履歴 をご覧ください。 参考 PEP 398 - Python 3.3 リリーススケジュール 概要 -- リリース ... 使った一括での複数 Process オブジェクト待ちが可能です。 map() と itertools.starmap() との関係と同じ、既存の multiprocessing.pool.Pool.map() と map_async() に対応する multiprocessing.pool.Pool.starmap() と starmap_async() が追加されました。 (Contribute ... により lzma エンコーディングをサポートするようになりました (Contributed by Lars Gustäbel in bpo-5689 .)。 tempfile tempfile.SpooledTemporaryFile の truncate() メソッドが size パラメータを受け付けるようになりました。 (Ryan Kelly による貢献、 bpo-9957 。 ...
https://man.mtool.work/python/3.14/whatsnew/3.3.html
Pythonモジュール索引 7901
Pythonモジュール索引 _ | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | z _ __future__ Future statement definitions __main__ The environment where top-level code is run. Covers command-line i ... my Dumb wrapper around threading. multiprocessing.managers Share data between process with shared objects. multiprocessing.pool Create pools of processes. multiprocessing.shared_memory Provides shared memory for direct access across processes. multip ...
https://man.mtool.work/python/3.14/py-modindex.html
A Conceptual Overview of asyncio 7780
A Conceptual Overview of asyncio この HOWTO では、 asyncio の基本的な仕組みをしっかり理解できるように説明します。 推奨される書き方がどのように動き、なぜ推奨されるのかを理解する助けになるでしょう。 asyncio の主要な概念について、疑問を持ってい ... s. Once it pauses or completes, it returns control to the event loop. The event loop will then select another job from its pool and invoke it. You can roughly think of the collection of jobs as a queue: jobs are added and then processed one at a time ...
https://man.mtool.work/python/3.14/howto/a-conceptual-overview-of-asyncio.html
ftplib --- FTP プロトコルクライアント 7780
ftplib --- FTP プロトコルクライアント ソースコード: Lib/ftplib.py このモジュールでは FTP クラスと、それに関連するいくつかの項目を定義しています。 FTP クラスは、FTPプロトコルのクライアント側の機能を備えています。このクラスを使うとFTPのいろい ... T' ) # list directory contents -rw-rw-r-- 1 1176 1176 1063 Jun 15 10:18 README ... drwxr-sr-x 5 1176 1176 4096 Dec 19 2000 pool drwxr-sr-x 4 1176 1176 4096 Nov 17 2008 project drwxr-xr-x 3 1176 1176 4096 Oct 10 2012 tools '226 Directory send OK.' >>> ...
https://man.mtool.work/python/3.14/library/ftplib.html
PREV 1 2 NEXT