subclassing Thread and start

Ype Kingma ykingma at accessforall.nl
Sun Jun 22 19:52:27 EDT 2003


...
>
> Your MyThread class could look like this"
>
>     class MyThread(threading.Thread):
>         def start(self):
>             threading.Thread.start(self)
>             self.id = id(self)
>             return self.id

In case you want to use self.id in the started thread,
this might be prefereable:

     class MyThread(threading.Thread):
         def start(self):
             self.id = id(self)
             threading.Thread.start(self)
             return self.id

Kind regards,
Ype




More information about the Python-list mailing list