* 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:
Raymond Hettinger 2004-01-29 06:37:52 +00:00
parent 141d4e5643
commit 756b3f3c15
15 changed files with 983 additions and 57 deletions

View file

@ -10,6 +10,7 @@ except ImportError:
from time import time as _time, sleep as _sleep
from traceback import format_exc as _format_exc
from collections import deque
# Rename some stuff so "from threading import *" is safe
__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
@ -639,7 +640,7 @@ def _test():
self.rc = Condition(self.mon)
self.wc = Condition(self.mon)
self.limit = limit
self.queue = []
self.queue = deque()
def put(self, item):
self.mon.acquire()
@ -657,7 +658,7 @@ def _test():
while not self.queue:
self._note("get(): queue empty")
self.rc.wait()
item = self.queue.pop(0)
item = self.queue.popleft()
self._note("get(): got %s, %d left", item, len(self.queue))
self.wc.notify()
self.mon.release()