diff --git a/pep-0343.txt b/pep-0343.txt index 175f02495..d20300882 100644 --- a/pep-0343.txt +++ b/pep-0343.txt @@ -258,7 +258,7 @@ Generator Decorator that makes it possible to use a generator that yields exactly once to control a with-statement. Here's a sketch of such a decorator: - class ContextManager(object): + class ContextWrapper(object): def __init__(self, gen): self.gen = gen @@ -287,14 +287,14 @@ Generator Decorator def contextmanager(func): def helper(*args, **kwds): - return ContextManager(func(*args, **kwds)) + return ContextWrapper(func(*args, **kwds)) return helper This decorator could be used as follows: @contextmanager def opening(filename): - f = open(filename) # IOError is untouched by ContextManager + f = open(filename) # IOError is untouched by ContextWrapper try: yield f finally: