Message194659
Using my latest patch, the ExitStack inline example can be rewritten:
with ExitStack() as stack:
files = [stack.enter_context(open(fname)) for fname in filenames]
# All opened files will automatically be closed at the end of
# the with statement, even if attempts to open files later
# in the list raise an exception
becomes:
with nested(opened(fname) for fname in filenames) as files:
do_stuff_with_files(files) |
|
Date |
User |
Action |
Args |
2013-08-08 10:43:07 | kristjan.jonsson | set | recipients:
+ kristjan.jonsson, ncoghlan, r.david.murray, eric.snow |
2013-08-08 10:43:07 | kristjan.jonsson | set | messageid: <1375958587.67.0.887335458452.issue18677@psf.upfronthosting.co.za> |
2013-08-08 10:43:07 | kristjan.jonsson | link | issue18677 messages |
2013-08-08 10:43:07 | kristjan.jonsson | create | |
|