classification
Title: threading.Thread.run returning a result
Type: enhancement Stage: resolved
Components: Library (Lib) Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: James.Lu, berker.peksag, pitrou
Priority: normal Keywords:

Created on 2013-07-29 20:34 by James.Lu, last changed 2016-04-18 23:23 by berker.peksag. This issue is now closed.

Files
File name Uploaded Description Edit
threading.py James.Lu, 2013-07-29 20:34
Messages (4)
msg193899 - (view) Author: James Lu (James.Lu) * Date: 2013-07-29 20:34
I have attached a *possible* new version of threading.py
that returns the value of the target.
msg193902 - (view) Author: James Lu (James.Lu) * Date: 2013-07-29 20:38
run's calling function needs to return.
msg193903 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-07-29 20:44
Hi! I'm not sure what feature exactly you're proposing here, but please follow the devguide's guidelines to submit a proper patch:
http://docs.python.org/devguide/patch.html
And more generally:
http://docs.python.org/devguide/
msg263700 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-04-18 23:23
What is your use case? I think this can easily be implemented by subclassing the threading.Thread class:

    class MyThread(threading.Thread):

        def run(self):
            # skip try...finally to make the example shorter
            result = None
            if self._target:
                result = self._target(*self._args, **self._kwargs)
            return result

We can reopen this if you can share a valid use case. Thanks for the report!
History
Date User Action Args
2016-04-18 23:23:49berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg263700

resolution: rejected
stage: resolved
2013-07-29 20:44:46pitrousetnosy: + pitrou
messages: + msg193903
2013-07-29 20:38:37James.Lusetmessages: + msg193902
2013-07-29 20:34:10James.Lucreate