Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Last active November 13, 2017 12:56
Show Gist options
  • Select an option

  • Save justdoit0823/91c50f183f18eceea9c23bb78a7098b2 to your computer and use it in GitHub Desktop.

Select an option

Save justdoit0823/91c50f183f18eceea9c23bb78a7098b2 to your computer and use it in GitHub Desktop.
Simulate golang channel in Python.
import queue
import threading
w_queue = queue.Queue(maxsize=10)
def foo():
w_queue.put('Hello, world')
def main():
f_worker = threading.Thread(target=foo)
f_worker.start()
print(w_queue.get())
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment