Quene

Dave Hansen iddw at hotmail.com
Wed Nov 30 12:53:31 EST 2005


On 30 Nov 2005 09:38:44 -0800 in comp.lang.python, "Tuvas"
<tuvas21 at gmail.com> wrote:

>I am trying to write a function that holds a variable-length quene. The
>quene has 2 bits of information. At some point, I would like to remove
>bits of this quene, when they are completed. Is there a way to do this
>with something as follows?
>

the following might work...

>quene=[]
>quene.append((4,2))
>quene.append((3,6))
>if(4 in quene):            #Shows false, what's the correct syntax to
>show true?

 found = [t for t in queue if t[0] == 4]
 if found:

>    remove 4 from quene #(Not python code, not sure how to do this...)
     queue.remove(found[0])

HTH,
                                        -=Dave

-- 
Change is inevitable, progress is not.



More information about the Python-list mailing list