Chris Angelico於 2013年5月20日星期一UTC+8下午5時09分13秒寫道:
> On Mon, May 20, 2013 at 6:35 PM, Cameron Simpson <c...@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

OK, if the python interpreter has a global hiden print out
buffer of ,say, 2to 16 K bytes, and all  string print functions
just construct the output string from the format to this string 
in an efficient low level way, then the next question 
would be that whether the uses can use functions in this 
low level buffer for other string formatting jobs.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to