Problem Regarding Queue

Rob Williscroft rtw at freenet.co.uk
Tue Feb 9 19:16:24 EST 2010


mukesh tiwari wrote in news:80fed7d5-76eb-40c8-ace1-0c35736de399
@t17g2000prg.googlegroups.com in comp.lang.python:

> Could some one please tell what is wrong with this code. I am trying
> to use Queue in this program but i am getting error

The type you appear to be trying to use is Queue.Queue which you import
with:

from Queue import Queue 

http://docs.python.org/library/queue.html?highlight=queue#Queue.Queue

>     Q_1=Queue()
>     Q_2=Queue()
>     Q_1.put(n)
>     while(not Q_1.empty()):
>         l=Q_1.get()
>         if(rabin_miller(l)):
>             Q_2.put(l)
>             continue
>         d=pollard(l)
>         if(d==l):Q_1.put(l)
>         else:

As the help page above points out also check out the deque Class:

http://docs.python.org/library/collections.html#collections.deque

Rob.



More information about the Python-list mailing list