python/dist/src/Doc/lib libbisect.tex, 1.11, 1.12 libqueue.tex, 1.13, 1.14

Jan. 29, 2004
6:38 a.m.
Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1631/Doc/lib Modified Files: libbisect.tex libqueue.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: libbisect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbisect.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libbisect.tex 26 Jun 2002 05:07:28 -0000 1.11 --- libbisect.tex 29 Jan 2004 06:37:48 -0000 1.12 *************** *** 81,101 **** >>> map(grade, [33, 99, 77, 44, 12, 88]) ['E', 'A', 'B', 'D', 'F', 'A'] - \end{verbatim} - The bisect module can be used with the Queue module to implement a priority - queue (example courtesy of Fredrik Lundh): \index{Priority Queue} - - \begin{verbatim} - import Queue, bisect - - class PriorityQueue(Queue.Queue): - def _put(self, item): - bisect.insort(self.queue, item) - - # usage - queue = PriorityQueue(0) - queue.put((2, "second")) - queue.put((1, "first")) - queue.put((3, "third")) - priority, value = queue.get() \end{verbatim} --- 81,84 ---- Index: libqueue.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libqueue.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libqueue.tex 15 Oct 2002 15:11:13 -0000 1.13 --- libqueue.tex 29 Jan 2004 06:37:48 -0000 1.14 *************** *** 13,20 **** Python. - \begin{seealso} - \seemodule{bisect}{PriorityQueue example using the Queue class} - \end{seealso} - The \module{Queue} module defines the following class and exception: --- 13,16 ----
7697
Age (days ago)
7697
Last active (days ago)
0 comments
1 participants
participants (1)
-
rhettingerï¼ projects.sourceforge.net