[Python-ideas] @run_as_thread decorator

Antoine Pitrou solipsis at pitrou.net
Sat Mar 5 17:32:11 CET 2011


On Sat, 05 Mar 2011 17:15:37 +0100
Georg Brandl <g.brandl at gmx.net> wrote:
> On 05.03.2011 17:08, Antoine Pitrou wrote:
> > On Sat, 05 Mar 2011 16:56:21 +0100
> > Georg Brandl <g.brandl at gmx.net> wrote:
> >> 
> >> > I'm rather opposed to this, it's a useless addition to the API with no
> >> > real point. Calling the Thread() constructor works basically ok.
> >> 
> >> Problem is, the one-liner doesn't give you a reference to the Thread object.
> > 
> > It does if you don't call start() :)
> 
> Then it's not a one-liner anymore :)

But neither is the original proposal!

@run_in_thread
def foo():
    ...

t = foo()





More information about the Python-ideas mailing list