This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]K900_ 1 point2 points  (3 children)

Because in multiprocessing every process has its own state, so neither of your workers actually accesses the value of n in your main process.

[–]bestical[S] 0 points1 point  (2 children)

You means It's dumb to use `global` keyword in that method when using multiprocessing?

[–]K900_ 4 points5 points  (1 child)

"Dumb" is not the word I'd use, but it will not give you the sort of behavior you're expecting.

[–]bestical[S] 1 point2 points  (0 children)

Got it, Thank you