Asynchronous Messaging

Fredrik Lundh fredrik at pythonware.com
Wed Sep 26 12:06:45 EDT 2007


wink wrote:

> But its performance is poor if the number of items on a
> Queue becomes large because it is implemented using a list.

> One of the things I was thinking of was doing another implementation
> using of Queue which was based on deque.

Updating from 2.3 to something newer will fix that, of course:

$ more Queue.py

...

from collections import deque

...

class Queue:

     ...

     def _init(self, maxsize):
         self.maxsize = maxsize
         self.queue = deque()

</F>




More information about the Python-list mailing list