Skip to main content

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mtfor-0.0.4-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

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

Hashes for mtfor-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 930f3bc1f5f6f28aaccfe812bcc7835f8b145e8c8c0ebec4b67ec8f211442b80
MD5 cc0b5fa1428e73f1c4eceec23397243f
BLAKE2b-256 5304da6ec5baac40cd23a243f7860485961fbd52aca5bd297319faebe55ce889

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page