Python Tutorial on Multithreading

Terry Reedy tjreedy at udel.edu
Tue Feb 22 00:32:46 EST 2011


On 2/21/2011 7:02 PM, KevinSimonson wrote:
> On Feb 21, 4:04 pm, Alexander Kapps<alex.ka... at web.de>  wrote:
>>
>> That tutorial seems to be wrong.
>>
>> According to the official docs:
>>
>> "If the subclass overrides the constructor, it must make sure to
>> invoke the base class constructor (Thread.__init__()) before doing
>> anything else to the thread."
>>
>> http://docs.python.org/library/threading.html#thread-objects
>>
>> So, change your __init__ to this:
>>
>> class myThread (threading.Thread):
>>       def __init__(self, threadID, name, q):
>>           threading.Thread.__init__(self)
>>           self.threadID = threadID
>>           self.name = name
>>           self.q = q
>>
>
> Alexander, thanks!  Your suggestion fixed my problem.

Please report the problem and solution on the tracker so the tutorial 
can be fixed.

-- 
Terry Jan Reedy




More information about the Python-list mailing list