Re: Thread Question



Em Ter, 2006-02-28 às 20:38 +0000, Grant Edwards escreveu:
On 2006-02-28, D <duncanm255@xxxxxxxxxxx> wrote:

Thanks, Grant. I apologize for not being clear on what I
meant by using "classes". This is an example of what I was
referring to:
http://www.wellho.net/solutions/python-python-threads-a-first-example.html

Ah, I see. I had forgotten that people subclass Thread like
that. It's mostly just a matter of style. There aren't any
practical differences that I can think of.

Within a class you can maintain lots of internal states and make it
easily changable by other threads. Sure, you could archive this with
functions, but IMHO it's not pythonic. But for simple cases both would
suffice.

--
"Quem excele em empregar a força militar subjulga os exércitos dos
outros povos sem travar batalha, toma cidades fortificadas dos outros
povos sem as atacar e destrói os estados dos outros povos sem lutas
prolongadas. Deve lutar sob o Céu com o propósito primordial da
'preservação'. Desse modo suas armas não se embotarão, e os ganhos
poderão ser preservados. Essa é a estratégia para planejar ofensivas."

-- Sun Tzu, em "A arte da guerra"

.



Relevant Pages

  • Re: Should we still be learning this?
    ... looks like this module is deprecated since Python 2.2. ... outros povos sem travar batalha, toma cidades fortificadas dos outros ...
    (comp.lang.python)
  • Re: Python Evangelism
    ... reports full of different forms of data presentations and such, ... outros povos sem travar batalha, toma cidades fortificadas dos outros ...
    (comp.lang.python)
  • Re: Rounding up to the nearest exact logarithmic decade
    ... it returns an int for some cases and a string for the ... outros povos sem travar batalha, toma cidades fortificadas dos outros ...
    (comp.lang.python)
  • Re: objects list index
    ... If you just want the index available inside the loop, ... outros povos sem travar batalha, toma cidades fortificadas dos outros ...
    (comp.lang.python)
  • Re: Newbie
    ... Linus with code conventions he doesn't like. ... outros povos sem travar batalha, toma cidades fortificadas dos outros ...
    (comp.lang.python)