use threading without classes
peter at engcorp.com
Wed Aug 31 14:18:43 CEST 2005
> Hi all. Hi would like to use two threads in a program but all the examples I
> found on the net use oop programming that I doesn't love too much. :-)
> Can you code me a short example in wich two different functions are executed
> at the same time, plz?
from threading import Thread
print 'first func running'
print 'first func done'
print 'second func running'
print 'second func done'
Note that this is still using "OOP programming", and you can't
effectively avoid this in Python without jumping through more hoops than
you're really interested in, but this basically avoids the need to do
OOP things like subclassing.
More information about the Python-list