[Python-ideas] @run_as_thread decorator
Bruce Leban
bruce at leapyear.org
Sat Mar 5 20:39:54 CET 2011
On Sat, Mar 5, 2011 at 11:31 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
> That strikes me as a bad idea, because another module or library calling
> refresh_persons() has no clue that this implictly starts a separate
> thread (instead of being a "normal" method).
>
>
You can always call functions that don't do what you think. There's a common
pattern for this:
def foo(bar):
return x(y(z(bar)))
@threading.run_as_thread
def foo_async(bar):
return foo(bar)
--- Bruce
New Puzzazz newsletter: http://j.mp/puzzazz-news-2011-02
Make your web app more secure: http://j.mp/gruyere-security
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110305/ea02504e/attachment.html>
More information about the Python-ideas
mailing list