Skip to content

Commit

Permalink
update pool example
Browse files Browse the repository at this point in the history
  • Loading branch information
briangu committed Jan 8, 2024
1 parent e07b7c7 commit 52f14bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/python/multiprocessing/pool.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import multiprocessing
import multiprocessing as mp

def square(n):
"""Function to square a number."""
return n * n

def runit(numbers):
"""Apply the square function in parallel to a list of numbers."""
with multiprocessing.Pool(1) as pool:
with mp.Pool() as pool:
results = pool.map(square, numbers)
return results

0 comments on commit 52f14bf

Please sign in to comment.