Add link back to original tracker issue, fix typo noticed by Chris Neugebauer

This commit is contained in:
Nick Coghlan 2011-12-15 22:30:55 +10:00
parent c1d261921b
commit dbc0c6d23f
2 changed files with 4 additions and 3 deletions

View file

@ -141,13 +141,14 @@ class closing(object):
self.thing.close()
# Inspired by discussions on http://bugs.python.org/issue13585
class ContextStack(object):
"""Context for programmatic management of resource cleanup
"""Context manager for programmatic management of resource cleanup
For example:
with ContextStack() as stack:
files = [stack.enter_context(fname) for fname in filenames]
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 throw an exception

View file

@ -199,7 +199,7 @@ API Reference
statement as follows::
with ContextStack() as stack:
files = [stack.enter_context(fname) for fname in filenames]
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 throw an exception