Module Queue :: Class Queue

[show private | hide private]
[frames | no frames]

## Class Queue

Known Subclasses:
  `TimeoutQueue`

Method Summary
| ``__init__`(self, maxsize)` Initialize a queue object with a given maximum size.
| ``empty`(self)` Return 1 if the queue is empty, 0 otherwise (not reliable!).
| ``full`(self)` Return 1 if the queue is full, 0 otherwise (not reliable!).
| ``get`(self, block)` Remove and return an item from the queue.
| ``get_nowait`(self)` Remove and return an item from the queue without blocking.
| ``put`(self, item, block)` Put an item into the queue.
| ``put_nowait`(self, item)` Put an item into the queue without blocking.
| ``qsize`(self)` Return the approximate size of the queue (not reliable!).

Method Details

### __init__(self, maxsize=0)
(Constructor)

Initialize a queue object with a given maximum size.

If maxsize is <= 0, the queue size is infinite.

### empty(self)

Return 1 if the queue is empty, 0 otherwise (not reliable!).

### full(self)

Return 1 if the queue is full, 0 otherwise (not reliable!).

### get(self, block=1)

Remove and return an item from the queue.

If optional arg 'block' is 1 (the default), block if necessary until an item is available. Otherwise (block is 0), return an item if one is immediately available, else raise the Empty exception.

### get_nowait(self)

Remove and return an item from the queue without blocking.

Only get an item if one is immediately available. Otherwise raise the Empty exception.

### put(self, item, block=1)

Put an item into the queue.

If optional arg 'block' is 1 (the default), block if necessary until a free slot is available. Otherwise (block is 0), put an item on the queue if a free slot is immediately available, else raise the Full exception.

### put_nowait(self, item)

Put an item into the queue without blocking.

Only enqueue the item if a free slot is immediately available. Otherwise raise the Full exception.

### qsize(self)

Return the approximate size of the queue (not reliable!).

Generated by Epydoc 1.1 on Sat Feb 15 21:17:44 2003 | http://epydoc.sf.net