[docs] [issue36731] Add example to priority queue

Windson Yang report at bugs.python.org
Thu Apr 25 23:01:37 EDT 2019


New submission from Windson Yang <wiwindson at outlook.com>:

We don't have the base example for priority queue in https://docs.python.org/3.8/library/heapq.html#priority-queue-implementation-notes, We can add something like:

> q = Q.PriorityQueue()
> q.put(10)
> q.put(1)
> q.put(5)
> while not q.empty():
    print q.get()

We may also need to add Notes about the PriorityQueue will block when we use max size 

> q = Q.PriorityQueue(1)
> q.put(10)
> q.put(1) # will block until the Queue is available again.

----------
assignee: docs at python
components: Documentation
messages: 340878
nosy: Windson Yang, docs at python
priority: normal
severity: normal
status: open
title: Add example to priority queue
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36731>
_______________________________________


More information about the docs mailing list