<p dir="ltr">It is pretty cool although it looks like a recursive function at first ;)</p>
<div class="gmail_quote">On 20 May 2013 10:13, "Chris Angelico" <<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson <<a href="mailto:cs@zip.com.au">cs@zip.com.au</a>> wrote:<br>
>   _lock = Lock()<br>
><br>
>   def lprint(*a, **kw):<br>
>     global _lock<br>
>     with _lock:<br>
>       print(*a, **kw)<br>
><br>
> and use lprint() everywhere?<br>
<br>
Fun little hack:<br>
<br>
def print(*args,print=print,lock=Lock(),**kwargs):<br>
  with lock:<br>
    print(*args,**kwargs)<br>
<br>
Question: Is this a cool use or a horrible abuse of the scoping rules?<br>
<br>
ChrisA<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</blockquote></div>