Please help with Threading

Fábio Santos fabiosantosart at gmail.com
Mon May 20 05:26:20 EDT 2013


It is pretty cool although it looks like a recursive function at first ;)
On 20 May 2013 10:13, "Chris Angelico" <rosuav at gmail.com> wrote:

> On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson <cs at zip.com.au> wrote:
> >   _lock = Lock()
> >
> >   def lprint(*a, **kw):
> >     global _lock
> >     with _lock:
> >       print(*a, **kw)
> >
> > and use lprint() everywhere?
>
> Fun little hack:
>
> def print(*args,print=print,lock=Lock(),**kwargs):
>   with lock:
>     print(*args,**kwargs)
>
> Question: Is this a cool use or a horrible abuse of the scoping rules?
>
> ChrisA
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130520/69e1ab65/attachment.html>


More information about the Python-list mailing list