Thread Question
Kent Johnson
kent at kentsjohnson.com
Tue Feb 28 15:43:38 EST 2006
D wrote:
> My question is, how would I go
> about creating the thread? I have seen examples that used classes, and
> other examples that just called one thread start command - when should
> you use one over another?
For simple use it doesn't matter. Use a class when you want to add more
state or behaviour - for example you might want a flag that tells the
thread to stop, or a Queue to communicate with the thread. A class might
be more convenient in these cases.
IOW if you can write it as a single function it doesn't matter much
which form you use; for more complex usage you may want a class.
Kent
More information about the Python-list
mailing list