title: Iterate through queue containing objects in python
body: <p>I'm new to python and just discovered a strange error when trying to iterate through a queue. </p>
  
  <p>Here's a code snippet:</p>
  
  <pre><code>frontier = q.PriorityQueue()
  
      for goal in goals:
          portals = findPortals(maze)
          comb_value = heuristic(startX, startY, goal[0], goal[1])
          frontier.put_nowait((comb_value, heuristic(startX, startY, goal[0], goal[1]), 0, startX, startY, startX, startY))
  
          for portal in portals:
              heur = portalHeuristic(maze, startX, startY, goal[0], goal[1])
              frontier.put_nowait((heur, heur, 0, startX, startY, startX, startY))
  
      for elem in list(frontier):
          print(elem)
  </code></pre>
  
  <p>When trying to print out the elements it says <code>TypeError: 'PriorityQueue' object is not iterable</code>. Can I fix this somehow? I tried to find some solutions on here, but I didn't really find anything I understood...</p>