|
|
|
|
|
by Peaker
5169 days ago
|
|
Here's some Haskell code I really like, and I think it would be far less nice in Python: replicateM 10 . forkIO . forever $ do
..
Which is basically the same as: replicateM 10 (forkIO (forever (do ..)))
replicateM 10 executes its code block argument 10 times. forkIO executes its code block argument in a new thread. forever loops forever.So this line basically creates a thread pool with 10 threads, all infinitely executing the given code block. How would you solve this in Python? |
|
The question is how does codeblocks solve this problem in Python, not how does Haskell solve this problem in Haskell.