summaryrefslogtreecommitdiffstats
path: root/Lib/Queue.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-01-29 06:37:52 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-01-29 06:37:52 (GMT)
commit756b3f3c15bd314ffa25299ca25465ae21e62a30 (patch)
treef504d3ab53c151b7e88ebfebd069a034f80f5025 /Lib/Queue.py
parent141d4e564314abde44189eb5e3a9f509dab045ff (diff)
downloadcpython-756b3f3c15bd314ffa25299ca25465ae21e62a30.zip
cpython-756b3f3c15bd314ffa25299ca25465ae21e62a30.tar.gz
cpython-756b3f3c15bd314ffa25299ca25465ae21e62a30.tar.bz2
* Move collections.deque() in from the sandbox
* Add unittests, newsitem, and whatsnew * Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py * Docs are forthcoming
Diffstat (limited to 'Lib/Queue.py')
-rw-r--r--Lib/Queue.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/Queue.py b/Lib/Queue.py
index 980aee6..44c9ca3 100644
--- a/Lib/Queue.py
+++ b/Lib/Queue.py
@@ -1,6 +1,7 @@
"""A multi-producer, multi-consumer queue."""
from time import time as _time, sleep as _sleep
+from collections import deque
__all__ = ['Empty', 'Full', 'Queue']
@@ -184,7 +185,7 @@ class Queue:
# Initialize the queue representation
def _init(self, maxsize):
self.maxsize = maxsize
- self.queue = []
+ self.queue = deque()
def _qsize(self):
return len(self.queue)
@@ -203,4 +204,4 @@ class Queue:
# Get an item from the queue
def _get(self):
- return self.queue.pop(0)
+ return self.queue.popleft()