Search Queue

abcd codecraig at
Tue Jan 16 16:22:30 CET 2007

I have a class such as...

id = 0
class Foo:
    def __init__(self, data): = id
        id += 1 = data

And I am storing them in a Queue.Queue...

import Queue
q = Queue.Queue()
q.put(Foo('hello world'))

how can I search "q" for an instance of Foo which has 'id' equal to say
2?  Typically a queue only lets you put and get, not really search.


More information about the Python-list mailing list