http://www.python.org/doc/2.5.2/lib/module-contextlib.html has this example:
from contextlib import contextmanager

@contextmanager
def tag(name):
    print "<%s>" % name
    yield
    print "</%s>" % name

contexlib.contextmanager doc string (2.5.1) says:
    Typical usage:
    
        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>
    
 Should I use the 'try', and 'finally' as in the 2nd example, or should I use 
the first example?  Does it matter?

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to