threading a 10 lines out of a file

Steve Holden steve at holdenweb.com
Mon Jan 5 13:13:29 EST 2009


alex goretoy wrote:
> I've found a great example on how to do threads. It compares a ping
> program in regular for loop and with threaded for loop. The link is
> below if anyone is interested.
> 
> http://www.wellho.net/solutions/python-python-threads-a-first-example.html
> 
> I hope my eagerness to post doesn't annoy anyone. I like to get as much
> info from as many places as possible and compare. This way I think I may
> have a better solution for a problem. Plus people that Google will find
> this post or any words in it. Any more information on threading a for
> loop would be greatly appreciated. TIA
> 
Your understanding that such eagerness can become annoying if taken too
far is appreciated. So far I haven't heard anyone suggest you should
move to comp.lang.somewhere-noobs-get-flamed ...

Be aware, however, that the CPython implementation won't net you any
benefit if all threads are CPU-bound, since due to something called the
GIL (global interpreter lock) no two threads will run concurrently.

If you search my past posts on threading you will doubtless find a
couple where I've posted my standard example. I don't want to bore
long-time readers (any more than I normally do) by repeating it yet again.

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list