sleep?
Peter Hansen
peter at engcorp.com
Fri Jan 25 19:52:49 EST 2002
More information about the Python-list mailing list
Fri Jan 25 19:52:49 EST 2002
- Previous message (by thread): sleep?
- Next message (by thread): sleep?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jason Orendorff wrote: > > Peter Hansen wrote: > > You don't want to use thread. You might want to use threading. > > Why does everyone keep knocking thread? > > >>> import thread, time > >>> def f(): > ... time.sleep(5) > ... print 'function ran' > ... > >>> thread.start_new_thread(f, ()) > > How can you not love that? Brief, simple, and clear. Nice for a toy function but I've never met a thread in Python which didn't benefit by being subclassed once or twice to provide some general functionality such as robust catching of exceptions and a way of stopping them nicely with a thread.stop() call (in my own code, that is). Matter of personal choice in my case, but I admit I was originally swayed by the _many_ comments I saw in this group dissing the thread module and promoting the threading module. Given the sources in question, I never had reason to question their advice. I'll pay more attention to any responses this time... -Peter
- Previous message (by thread): sleep?
- Next message (by thread): sleep?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list