Question regarding Queue object
David
wizzardx at gmail.com
Sun Apr 27 09:53:31 EDT 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.
David
More information about the Python-list
mailing list