Skip to content

Commit e19a4b8

Browse files
committed
Use natural set type for thread.py
1 parent 6809655 commit e19a4b8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎ultimatepython/advanced/thread.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import time
2525
from concurrent.futures import ThreadPoolExecutor, as_completed
2626
from datetime import datetime
27-
from typing import Callable, Iterable, Set
27+
from typing import Callable, Iterable
2828

2929
# Module-level constants
3030
_MULTIPLY_DELAY = 0.01 # delay is long enough for threads to be faster
@@ -36,15 +36,15 @@ def multiply_by_two(item: int) -> int:
3636
return item * 2
3737

3838

39-
def run_thread_workers(work: Callable[[int], int], data: Iterable[int]) -> Set[int]:
39+
def run_thread_workers(work: Callable[[int], int], data: Iterable[int]) -> set[int]:
4040
"""Run thread workers that invoke work on each data element.
4141
4242
The inspiration for this function comes directly from an example
4343
in the Python 3.x documentation:
4444
4545
https://docs.python.org/3/library/concurrent.futures.html
4646
"""
47-
results: Set[int] = set()
47+
results: set[int] = set()
4848

4949
# We can use a with statement to ensure workers are cleaned up promptly
5050
with ThreadPoolExecutor() as executor:

0 commit comments

Comments
 (0)