Interesting Thread Gotcha

Diez B. Roggisch deets at
Wed Jan 16 17:06:30 CET 2008

Hendrik van Rooyen wrote:

> "Dan" <the,,,> wrote:
>> >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q))
>> Needs to be
>> >>> keyboard_thread = thread.start_new_thread(kbd_driver, (port_q,kbd_q))
>> Commas are important!
>> -Dan
> Absolutely! - well spotted!
> As the first correct respondent, you win the freedom to spend a week in
> Naboomspruit at your own expense.
> It would have been nice, however, to have gotten something like:
> TypeError - This routine needs a tuple.
> instead of the silent in line calling of the routine in question,
> while failing actually to start a new thread.

You can't prevent the silent inline-calling - otherwise, how would you do

def compute_thread_target():
    def target():
    return target


Of course start_new_thread could throw an error if it got nothing callable
as first argument. No idea why it doesn't.


More information about the Python-list mailing list