Plug 'n' play multithreaded for
Project description
What is mtfor
"mtfor" or "multithreaded for" is a simple package that provides a for loop that automatically distributes the processing through a number of threads.
Installation
You can use pip3 to install this utility by executing:
pip3 install mtfor
Usage
The function signature is mtfor(list, function, number_of_threads). It returns your list already modified.
This example prints the result of applying my_function to my_list using 4 threads.
from mtfor import mtfor
NUM_THREADS = 4
def my_function(x):
return x * x
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
modified_list = mtfor(my_list, my_function, NUM_THREADS)
print(modified_list)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mtfor-0.0.4-py3-none-any.whl.
File metadata
- Download URL: mtfor-0.0.4-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
930f3bc1f5f6f28aaccfe812bcc7835f8b145e8c8c0ebec4b67ec8f211442b80
|
|
| MD5 |
cc0b5fa1428e73f1c4eceec23397243f
|
|
| BLAKE2b-256 |
5304da6ec5baac40cd23a243f7860485961fbd52aca5bd297319faebe55ce889
|