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
interface methods are:
- __init__ (maxsize)
-
Constructor for the class. maxsize is an integer that sets the
upperbound limit on the number of items that can be placed in the
queue. Insertion will block once this size has been reached, until
queue items are consumed. If maxsize is less than or equal to
zero, the queue size is infinite.
- 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@CNRI.Reston.Va.US