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
"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,
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
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
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
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('test'))
how can I search "q" f