Python Glossary Русский

Python 3.7+queueterm

queue.SimpleQueue

queues

A simple unbounded thread-safe FIFO queue without task_done() and join().

Syntax

q = queue.SimpleQueue(); q.put(item); q.get(block=True, timeout=None)

It is lighter and faster than Queue but cannot bound its size or track task completion. Its put() is reentrant, so it is safe to call from signal handlers and __del__ methods, where Queue could deadlock. Choose it when you do not need join().

Examples

import queue
q = queue.SimpleQueue()
q.put(1)
q.put(2)
print(q.get(), q.qsize())  # → 1 1
print(hasattr(q, 'join'), hasattr(q, 'task_done'))  # → False False

See also

Open in the full glossarydocs.python.orgReport an inaccuracy