Em Ter, 2006-02-28 às 20:38 +0000, Grant Edwards escreveu: > On 2006-02-28, D <[EMAIL PROTECTED]> 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" -- http://mail.python.org/mailman/listinfo/python-list