On May 3, 2005, at 12:53 PM, Guido van Rossum wrote:
> def saving_stdout(f):
>     save_stdout = sys.stdout
>     try:
>         sys.stdout = f
>         yield
>     finally:
>         sys.stdout = save_stdout

I hope you aren't going to be using that in any threaded program. 
That's one really nice thing about lisp's dynamic variables: they 
automatically interact properly with threads.

(defvar *foo* nil)
(let ((*foo* 5))
   ; *foo* has value of 5 for all functions called from here, but only 
in this thread. In other threads it'll still be nil.
)
; *foo* has gone back to nil.

James

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to