Re: Search Queue

2007-01-16 Thread Gabriel Genellina
At Tuesday 16/1/2007 15:01, Dennis Lee Bieber wrote: If "Queue like functionality" means inserting at the end, and removing from the front... Just use a list Someone said that time complexity should be part of an object public interfase. Implementing a queue using Python lists is triv

Re: Search Queue

2007-01-16 Thread Gabriel Genellina
"abcd" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Yea basically I need Queue like functionality with the ability to > search for a particular instance in it. I guess I could just use a > list and search it as needed. Perhaps the Queue class should be called ThreadQueue,

Re: Search Queue

2007-01-16 Thread abcd
Yea basically I need Queue like functionality with the ability to search for a particular instance in it. I guess I could just use a list and search it as needed. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Search Queue

2007-01-16 Thread Tim Golden
abcd wrote: > I have a class such as... [... ] > And I am storing them in a Queue.Queue... > > import Queue > q = Queue.Queue() > q.put(Foo('blah')) > q.put(Foo('hello world')) > q.put(Foo('test')) > > how can I search "q" for an instance of Foo which has 'id' equal to say > 2? Typically a queue

Re: Search Queue

2007-01-16 Thread Bill Scherer
abcd wrote: >I have a class such as... > >id = 0 >class Foo: >def __init__(self, data): >self.id = id >id += 1 >self.data = data > >And I am storing them in a Queue.Queue... > >import Queue >q = Queue.Queue() >q.put(Foo('blah')) >q.put(Foo('hello world')) >q.put(Foo('te