Thread Question

Grant Edwards grante at visi.com
Tue Feb 28 15:42:46 EST 2006


On 2006-02-28, Felipe Almeida Lessa <felipe.lessa at gmail.com> wrote:

> # He meant calling direct vs. subclassing. In your example you called
>   the Thread class directly, but you could have subclassed it.

Yup.  I should have realized that.

> # In your case, Edwards, I'd prefer subclassing because then you could
> put some states in the class. A (bad) example:

[...]

Good example.

It's probably bad style, but in my programs the "state info"
like that usually ends up being global variables since it's
also "attached" to thinks like GUI buttons and indicators.  I
never have more than one instance of the thread, so I can get
away with it.  If you need multiple instances of stateful
threads, you really do want to subclass Thread.

-- 
Grant Edwards                   grante             Yow!  I'm in DISGUISE as a
                                  at               BAGGAGE CHECKER....I can
                               visi.com            watch the house, if it's
                                                   ORANGE...



More information about the Python-list mailing list