[Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.28, 1.29

Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1631/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: * 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 Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** whatsnew24.tex 18 Jan 2004 15:55:51 -0000 1.28 --- whatsnew24.tex 29 Jan 2004 06:37:48 -0000 1.29 *************** *** 323,326 **** --- 323,351 ---- \end{itemize} + \item There is a new \module{collections} module which currently offers + just one new datatype, \class{deque}, which offers high-performance, + thread-safe, memory friendly appends and pops on either side of the + deque resulting in efficient stacks and queues: + + \begin{verbatim} + >>> from collections import deque + >>> d = deque('ghi') # make a new deque with three items + >>> d.append('j') # add a new entry to the right side + >>> d.appendleft('f') # add a new entry to the left side + >>> d # show the representation of the deque + deque(['f', 'g', 'h', 'i', 'j']) + >>> d.pop() # return and remove the rightmost item + 'j' + >>> d.popleft() # return and remove the leftmost item + 'f' + >>> list(d) # list the contents of the deque + ['g', 'h', 'i'] + >>> 'h' in d # search the deque + True + \end{verbatim} + + Several modules now take advantage of \class{collections.deque()} for + improved performance: \module{Queue}, \module{mutex}, \module{shlex} + \module{threading}, and \module{pydoc}. \item The \module{heapq} module has been converted to C. The resulting
participants (1)
-
rhettingerï¼ projects.sourceforge.net