mirror of
https://github.com/python/cpython.git
synced 2025-10-09 08:31:26 +00:00
* 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
This commit is contained in:
parent
141d4e5643
commit
756b3f3c15
15 changed files with 983 additions and 57 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue