Antoine Pitrou <pit...@free.fr> added the comment:

>     with ContextStack() as stack:
>         files = [stack.enter_context(open(fname)) for fname in filenames]

I find this a bit distasteful. Cleaning up resources now needs something called 
a "ContextStack" and an "enter_context" method call. There's a bit too much 
terminology, and it looks like a poor man's equivalent of Go's "defer" 
statement:
http://blog.golang.org/2010/08/defer-panic-and-recover.html

I like unittest's addCleanup mechanism better.

----------
nosy: +pitrou

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13585>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to