queue
The queue
module is a standard library in Python.
The queue
module provides the following classes:
queue.Queue(maxsize=0)
: A first-in, first-out (FIFO) queue.queue.LifoQueue(maxsize=0)
: A last-in, first-out (LIFO) queue.queue.PriorityQueue(maxsize=0)
: A priority queue.
In these classes, the maxsize
parameter is an integer that sets the maximum number of items that can be placed in the queue. If maxsize
is less than or equal to zero, the queue size is infinite.
queue.Queue
The queue.Queue
class is a FIFO queue.
queue.LifoQueue
queue.PriorityQueue
The queue.PriorityQueue
class is a priority queue.
In the priority queue, the lowest value is retrieved first. A typical pattern for entries is a tuple in the form (priority_number, data)
.
Last updated