Stephen Hansen wrote:
On Mon, Dec 21, 2009 at 3:12 PM, Gib Bogle
<g.bo...@auckland.no.spam.ac.nz> wrote:
 #spawn a pool of threads, and pass them queue instance
 for i in range(5):
   t = ThreadUrl(queue,i)
   t.setDaemon(True)
   t.start()

 #populate queue with data
   for host in hosts:
     queue.put(host)

This is indented over one indentation level too much. You want it to
be at the same level as the for above. Here, its at the same level
with "t" -- meaning this entire loop gets repeated five times.

I sorta really recommend a tab width of 4 spaces, not 2 :) At 2, its
_really_ hard (especially if you're newer to Python) to see these
kinds of issues and since indentation is program logic and structure
in Python, that's bad... especially since your comment is indented to
the right level, but the code isn't :)

--S

Aarrh! Caught by the obvious Python trap that everyone knows about! In my defense, it's wrong on the web site. I agree, 4 spaces is the best plan. Thanks very much!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to