Classes and threading

Duncan Booth duncan.booth at invalid.invalid
Wed May 19 04:17:41 EDT 2010


"Adam W." <awasilenko at gmail.com> 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 would I?
> 
No, you just have to handle them the way you would for any function that 
accepts arguments that it doesn't know in advance:

class nThread(threading.Thread):
    def __init__(self, *args, **kw):
        threading.Thread.__init__(self, *args, **kw)

If you want to add your own additional arguments then name them explicitly  
and don't pass them through:

class nThread(threading.Thread):
    def __init__(self, myarg1, mayarg2, *args, **kw):
        threading.Thread.__init__(self, *args, **kw)


-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list