Re: Classes and threading

2010-05-19 Thread Aahz
In article , Christian Heimes wrote: >> >> class nThread(threading.Thread): >> def __init__(self, *args, **kwds): >> threading.Thread.__init__(self, *args, **kwds) >> # your other stuff here > >Since Thread is a new style class, this should read: > >class NThre

Re: Classes and threading

2010-05-19 Thread Christian Heimes
Or if you do need to override it for some reason, you need to accept the extra args and pass them on: class nThread(threading.Thread): def __init__(self, *args, **kwds): threading.Thread.__init__(self, *args, **kwds) # your other stuff here Since Thread is a

Re: Classes and threading

2010-05-19 Thread Adam W.
On May 19, 4:30 am, Gregory Ewing wrote: > Or if you do need to override it for some reason, you > need to accept the extra args and pass them on: > >    class nThread(threading.Thread): > >        def __init__(self, *args, **kwds): >            threading.Thread.__init__(self, *args, **kwds) >    

Re: Classes and threading

2010-05-19 Thread Gregory Ewing
Erik Max Francis wrote: Adam W. wrote: class nThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) If you don't intend to override the constructor in the parent class, simply don't define it. Or if you do need to override it for some reason, you need to

Re: Classes and threading

2010-05-19 Thread Duncan Booth
"Adam W." wrote: >> If you don't intend to override the constructor in the parent class, >> simply don't define it. > > Hummm, so lets say I wanted it pass all the variables to the parent > constructor, how would I do that? I wouldn't have to list every > variable it could possible receive woul

Re: Classes and threading

2010-05-19 Thread Adam W.
On May 19, 12:04 am, Erik Max Francis wrote: > Adam W. wrote: > > I thought I knew how classes worked, but this code sample is making my > > second guess myself: > > > import threading > > > class nThread(threading.Thread): > >     def __init__(self): > >         threading.Thread.__init__(self) >

Re: Classes and threading

2010-05-18 Thread Erik Max Francis
Adam W. wrote: I thought I knew how classes worked, but this code sample is making my second guess myself: import threading class nThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self,args): print self.name print self.args

Classes and threading

2010-05-18 Thread Adam W.
I thought I knew how classes worked, but this code sample is making my second guess myself: import threading class nThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self,args): print self.name print self.args pants = nThread(a