passing argumetns to threading.Thread

sashan mabus at operamail.com
Sat Oct 4 22:34:27 EDT 2003


> You can, however, use instance variables since Reader is an object:
> 
> class Reader(threading.Thread):
>         def __init__(self, conn):
>                 threading.Thread.__init__(self)  # no need for extra args
>                 self.conn = conn
> 
>         def run(self):
>                 while 1:
>                         data = self.conn.recv(1024)
>                         print data
> 
> -Peter

Thanks





More information about the Python-list mailing list