Question regarding Queue object

David wizzardx at
Sun Apr 27 15:53:31 CEST 2008

>  WaitMsg will get only msg with certain ids, but this is not possible
>  in Queue object, because Queue provides no method to peek into the
>  message queue and fetch only matched item.
>  Now I'm using an ugly solution, fetch all the messages and put the not
>  used ones back to the queue. But I want a better performance. Is there
>  any alternative out there?

You could try a defaultdict containing queues, one queue per message ID.

Or you could implement your own thread-safe LookAheadQueue class.


More information about the Python-list mailing list