Author roysmith
Recipients docs@python, r.david.murray, rhettinger, roysmith
Date 2011-01-31.13:19:14
SpamBayes Score 1.89932e-07
Marked as misclassified No
Message-id <>
Here's the code I ended up writing:

class Foo():
   def __init__(self):
       self.thread = Thread(target=Foo.runner, args=[self])

   def runner(self):
      # blah, blah, blah

It was not immediately clear from the documentation if my runner() method should be declared static or not.  In retrospect, it must be (since this can be used with target functions which are not class methods at all), but it took a bit of thought to get from what the documentation said (i.e. 'callable object to be invoked by the run() method') to that conclusion.  

It seems to me the documentation could be a bit more explicit that your target does not get called as a method of some object.  Changing the text to read, "static function or other callable object" would remove any such confusion.

It could be that some of my confusion is due to my previously working with a C++ threading package where the thread runner functions *were* class methods.  Still, it seems like the potential for other people to be similarly confused exists and a little tweaking of the documentation text would help.
Date User Action Args
2011-01-31 13:19:15roysmithsetrecipients: + roysmith, rhettinger, r.david.murray, docs@python
2011-01-31 13:19:15roysmithsetmessageid: <>
2011-01-31 13:19:14roysmithlinkissue11073 messages
2011-01-31 13:19:14roysmithcreate