[Python-checkins] python/nondist/peps pep-0343.txt,1.28,1.29
gvanrossum@users.sourceforge.net
gvanrossum at users.sourceforge.net
Tue Jul 12 18:28:59 CEST 2005
Update of /cvsroot/python/python/nondist/peps
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31380
Modified Files:
pep-0343.txt
Log Message:
Rename class ContextManager to ContextWrapper, per Nick's proposal.
Index: pep-0343.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0343.txt,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- pep-0343.txt 12 Jul 2005 16:27:53 -0000 1.28
+++ pep-0343.txt 12 Jul 2005 16:28:56 -0000 1.29
@@ -258,7 +258,7 @@
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 @@
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:
More information about the Python-checkins
mailing list