PyDocs

Nav

Networking and Interprocess Communication

Queue

asyncio

class (source) not WASI
  • Queue(maxsize=0)
A queue, useful for coordinating producer and consumer coroutines.

If maxsize is less than or equal to zero, the queue size is infinite.
If it is an integer greater than 0, then "await put()" will block when
the queue reaches maxsize, until an item is removed by get().

Unlike queue.Queue, you can reliably know this Queue's size
with qsize(), since your single-threaded asyncio application won't be
interrupted between calling qsize() and doing an operation on the Queue.
Changed in 3.10
  • 3.10: Removed the loop parameter.
Members of Queue

e

empty
Return True if the queue is empty, False otherwise.

f

full
Return True if there are maxsize items in the queue.

g

get
Remove and return an item from the queue.
get_nowait
Remove and return an item from the queue.

j

join
Block until all items in the queue have been gotten and processed.

m

maxsize
Number of items allowed in the queue.

p

put
Put an item into the queue.
put_nowait
Put an item into the queue without blocking.

q

qsize
Number of items in the queue.

s

shutdown
Shut-down the queue, making queue gets and puts raise QueueShutDown.

t

task_done
Indicate that a formerly enqueued task is complete.
0 Examples
No examples for asyncio/Queue.
See Also
No see-alsos for asyncio/Queue
0 Notes
No notes for Queue