Asynchronous Messaging

Fredrik Lundh fredrik at
Wed Sep 26 18:06:45 CEST 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


from collections import deque


class Queue:


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


More information about the Python-list mailing list