Message150080
| Author |
pitrou |
| Recipients |
Julian, eric.araujo, eric.snow, giampaolo.rodola, ncoghlan, nikratio, pitrou, rhettinger, smarnach |
| Date |
2011年12月22日.08:47:12 |
| SpamBayes Score |
0.0024391843 |
| Marked as misclassified |
No |
| Message-id |
<1324543633.39.0.305509262673.issue13585@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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. |
|