error: argument after ** must be a dictionary

Kent Johnson kent at kentsjohnson.com
Wed Mar 1 07:36:14 EST 2006


bruno at modulix wrote:
> abcd wrote:
> 
>>    def makeThread(self, func, args=(), kwargs={}):
>>        threading.Thread(target=self.blah, args=args,
>>kwargs=kwargs).start()
> 
> Shouldn't it be:
> 
> def makeThread(self, func, *args, **kwargs):
>   threading.Thread(target=self.blah,
>                    *args,
>                    **kwargs).start()

No. threading.Thread() doesn't use *args, **kwargs, it uses explicit 
named parameters.

Kent



More information about the Python-list mailing list