Metadata-Version: 2.1
Name: python-multithreading
Version: 0.0.0
Summary: A python module for creating multithreading processes easily, in a more Pythonic way.
Home-page: https://github.com/Shahaf-F-S/multithreading
Author: Shahaf Frank-Shapir
Author-email: shahaffrs@gmail.com
License: MIT
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: pdoc3; extra == "dev"
Requires-Dist: twine; extra == "dev"

# multithreading

> A python module for creating multithreading processes easily, in a more Pythonic way.

## example

```python
import time

from multithreading import Caller, multi_threaded_call

def slow_function(number: int, delay: float) -> dict[str, int | float]:

    for i in range(number):
        time.sleep(delay)

    return dict(number=number, delay=delay)

CALLS = 50
DELAY = 0.01
NUMBER = 100

callers = [
    Caller(
        target=slow_function,
        kwargs=dict(delay=DELAY, number=NUMBER)
    ) for _ in range(CALLS)
]

s = time.time()

multi_threaded_call(callers)

e = time.time()

print("multi-threading: ", e - s)

s = e

all(slow_function(*caller.args, **caller.kwargs) for caller in callers)

e = time.time()

print("single-threading: ", e - s)
```

output
```
multi-threading: 1.0473840236663818
single-threading: 52.53497314453125
```
