threads

Aahz aahz at pythoncraft.com
Tue Jan 27 20:15:10 EST 2004


In article <401706AB.6020703 at hotmail.com>,
Bart Nessux  <bart_nessux at hotmail.com> wrote:
>
>Thank you both for the info on threads in Python it was very helpful to 
>me, I've written something that I think can benefit from threading... 
>here is the code, I copied this from a few books and a few Web examples 
>and modified it to suit my test:
>
>class trivialthread(threading.Thread):
>    def url_open(self):
>       for x in xrange(999999):
>          f = urllib.urlopen("http://xxx.xxx.xxx")
>          f.read()
>          f.close()
>          print self, x

Rename ``url_open()`` to ``run()``.  You might want to read the
slideshow on my web site, paying particular attention to the examples.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR



More information about the Python-list mailing list