Message193599
On Jul 23, 2013, at 04:24 AM, Alexander Belopolsky wrote:
>@contextlib.contextmanager
>def redirect_stdout(stream):
> old_stdout = sys.stdout
> sys.stdout = stream
> yield
> sys.stdout = old_stdout
Make that:
@contextlib.contextmanager
def redirect_stdout(stream):
old_stdout = sys.stdout
sys.stdout = stream
try:
yield
finally:
sys.stdout = old_stdout
and I'll be able to remove those 8 lines of code from all my other code bases
:) |
|
Date |
User |
Action |
Args |
2013-07-23 12:53:35 | barry | set | recipients:
+ barry, rhettinger, ncoghlan, belopolsky, pitrou, vstinner, ezio.melotti, alex, nikratio, Marc.Abramowitz |
2013-07-23 12:53:35 | barry | link | issue15805 messages |
2013-07-23 12:53:35 | barry | create | |
|