passing threading.Thread() and function object

Christopher J. Bottaro cjbottaro at alumni.cs.utexas.edu
Wed Oct 13 14:17:21 EDT 2004


Hello,

I'm new to Python programming, so please excuse me.

thread = threading.Thread(self.somefunc())
thread.start()
print "Thread started"

def somefunc(self):
        while (1)
                print "In thread"


"Thread started" never gets printed, but "In thread" gets printed
repeatedly.  What is going on?  It seems like thread.start() is blocking
and effectively running self.somefunc() as a normal function.

Thanks for the help.




More information about the Python-list mailing list