Created
October 29, 2015 23:42
-
-
Save jimjh/ad357b77c39d1fda6614 to your computer and use it in GitHub Desktop.
sharing state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def x(): | |
# using a function as a convenient global object | |
print 'hello!' | |
x.favorite_band = 'Maroon 5' | |
def went_to_music_festival(s): | |
print 'favorite band was ' + x.favorite_band | |
x.favorite_band = s | |
print 'favorite band is ' + x.favorite_band | |
from multiprocessing import Pool | |
pool = Pool(processes=10) | |
pool.map(went_to_music_festival, ['Made In Heights', 'The Who'], 1) | |
print x.favorite_band |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment