queue.Queue()
queue.Queue() is a Python function in the Queue Module category. Creates a FIFO (First-In-First-Out) thread-safe queue. The syntax is queue.Queue(maxsize=0). Parameters: maxsize — 0 = unlimited. Returns: Queue object. A typical example: from queue import Queue
q = Queue()
q.put("item1")
q.put("item2")
item = q.get() # "item1" (FIFO). A close sibling is queue.LifoQueue(), which creates a LIFO (Last-In-First-Out) thread-safe queue (stack). A close sibling is queue.PriorityQueue(), which creates a thread-safe priority queue (lowest value is retrieved first). A close sibling is Queue.put(), which puts an item into the queue. Blocks if full until space is available. A close sibling is Queue.get(), which removes and returns an item from the queue. Blocks if empty. More about this category: Thread-safe queues — Queue, LifoQueue, PriorityQueue, SimpleQueue. Related Queue Module entries: queue.LifoQueue(), queue.PriorityQueue(), Queue.put(), Queue.get(), Queue.task_done(), Queue.join(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.