7.5.1 Queue Objects

Class Queue implements queue objects and has the methods described below. This class can be derived from in order to implement other queue organizations (e.g. stack) but the inheritable interface is not described here. See the source code for details. The public methods are:

qsize ()
Returns the approximate size of the queue. Because of multithreading semantics, this number is not reliable.

empty ()
Returns 1 if the queue is empty, 0 otherwise. Because of multithreading semantics, this is not reliable.

full ()
Returns 1 if the queue is full, 0 otherwise. Because of multithreading semantics, this is not reliable.

put (item)
Puts item into the queue.

get ()
Gets and returns an item from the queue, blocking if necessary until one is available.

get_nowait ()
Gets and returns an item from the queue if one is immediately available. Raises an Empty exception if the queue is empty or if the queue's emptiness cannot be determined.

guido@python.org