[Tutor] Python threads

orbitz at ezabel.com orbitz at ezabel.com
Thu Jun 10 19:36:36 EDT 2004


Doing things asynchronously is easy with twisted.  http://www.twistedmatrix.com/

On Thu, 10 Jun 2004 16:10:11 -0700 (PDT)
<tpc at csua.berkeley.edu> wrote:

> 
> 
> On Thu, 10 Jun 2004, Danny Yoo wrote:
> 
> > I have to ask a silly question: why is the class threaded?  I don't see
> > the need for the threading here.  Since threaded programming can be
> > complicated, it might be a better idea to avoid it for this particular
> > problem.
> >
> 
> hi Danny, I created an application that indexes .mp3 and .wmv files
> and, depending on user input, returns the files that have the
> corresponding words in the filename, along with the file category
> (i.e., Audio or Video) and the time-duration of the file.  I noticed a
> marked increase in the time it took from the moment the user pressed
> 'Submit' to the results appearing in the browser when I ported
> my application from Redhat Linux 9/Fedora Core 1/Fedora Core 2 to
> Debian Linux.  I used hotshot profiler to arrive at an average of 2.302
> seconds for the former to 42.315 seconds for the latter.  The reason I
> had to go the multithreaded route was because I went to:
> 
> http://www.python.org/doc/current/lib/module-urllib.html
> 
> and at the bottom of the page you will notice:
> 
> "The urlopen() and urlretrieve() functions can cause arbitrarily long
> delays while waiting for a network connection to be set up.  This means
> that it is difficult to build an interactive Web client using these
> functions without using threads."
> 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list