title: How to broadcast messages among processes in Python?
body: <p>I am creating a list of nodes in Python and I wish they can broadcast messages among themselves.</p>
  
  <p>The current code is:</p>
  
  <pre><code>import multiprocessing as mp
  NUM_PROC = 10
  import time
  
  
  class Node(object):
  
      def __init__(self, node_id):
          self.id = node_id
          self.neighbours = []
  
      def talk_to_neighbours(self):
          for n in self.neighbours:
              print "Hi Node " + str(n.id) + ", this is greeting from Node " + str(self.id)
              time.sleep(1)
  
  def wrapper_func(node):
      return node.talk_to_neighbours()
  
  if __name__ == '__main__':
      node_list = [Node(i) for i in range(10)]
  
      for node in node_list:
          node.neighbours = [neighbour_node for neighbour_node in node_list if neighbour_node.id != node.id]
  
      pool = mp.Pool(NUM_PROC)
      pool.map(wrapper_func, node_list)
      pool.close()
      pool.join()
  </code></pre>
  
  <p>where there is no IPC at all.</p>
  
  <p>The basic utilities <code>Queues</code> and <code>Pipes</code> of the <code>multiprocessing</code> module doesn't look like natively supporting broadcast.
  What I can think of is to connect each pair of nodes manually and then use <code>Queues</code> and <code>Pipes</code>.
  I am wondering if there are any simpler solutions since this one is tedious.</p>