This bit of code hangs Python Indefinitely
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Aug 8 09:44:35 EDT 2007
On Wed, 08 Aug 2007 09:38:49 -0400, brad wrote:
> url_queue = Queue.Queue(256)
> for subnet in subnets:
> url_queue.put(subnet)
>
> The problem is that I have 512 things to add to the queue, but my limit
> is half that... whoops. Shouldn't the interpreter tell me that I'm an
> idiot for trying to do this instead of just hanging? A message such as
> this would be more appropriate:
>
> "Hey fool, you told me to only accept 256 things and you're trying to
> give me 512... what's up with that?"
No because you can get some things from that queue from another thread and
then the ``for``-loop goes on. That's the typical use case for queues.
Why did you put an upper bound to the queue?
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list