3 ms·
Two spaces in front of each line of the code block. As written, right now, your comment is hard to parse: import threading def produce(): global globa
by Jtsummers 5y ago
Two spaces in front of each line of the code block. As written, right now, your comment is hard to parse:
import threading
def produce():
global global_foo
local_foo = "potato"
global_foo = local_foo
def consume():
global global_foo
local_foo = global_foo
global_foo = None
if __name__ == '__main__':
produce()
thread = threading.Thread(target=consume)
thread.start()
thread.join()