Multiprocessing/multithreading made easy
Project description
multifutures
Multiprocessing/multithreading made easy!
Table of Contents
Installation
python -mpip install multifutures
Usage
import multifutures as mf
def return_square(number: float) -> float:
squared = number**2
return squared
results = mf.multiprocess(
func=return_square,
func_kwargs=[{"number": i} for i in range(10)],
)
for result in results:
print(result)
Will print:
FutureResult(exception=None, kwargs={'number': 0}, result=0)
FutureResult(exception=None, kwargs={'number': 1}, result=1)
FutureResult(exception=None, kwargs={'number': 2}, result=4)
FutureResult(exception=None, kwargs={'number': 3}, result=9)
FutureResult(exception=None, kwargs={'number': 4}, result=16)
FutureResult(exception=None, kwargs={'number': 5}, result=25)
FutureResult(exception=None, kwargs={'number': 6}, result=36)
FutureResult(exception=None, kwargs={'number': 7}, result=49)
FutureResult(exception=None, kwargs={'number': 8}, result=64)
FutureResult(exception=None, kwargs={'number': 9}, result=81)
License
multifutures
is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
multifutures-0.3.2.tar.gz
(8.3 kB
view hashes)
Built Distribution
Close
Hashes for multifutures-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ab88743d9734df949c58a97342ebeafacb4a933ebba3a57d67f69223a3b31d7 |
|
MD5 | 96027ff2509e146920666a7736fbfa73 |
|
BLAKE2b-256 | 499448fd3e3a22d29dede9f79a19c78a39555679f4a50dd4b2a07fefc61623fa |