Created
February 25, 2014 06:49
-
-
Save yuuichi-fujioka/9204003 to your computer and use it in GitHub Desktop.
with example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo(): | |
def __enter__(self): | |
print 'begin transaction' | |
return self | |
def __exit__(self, type, value, traceback): | |
if value: | |
print 'An error has occured in this transaction' | |
else: | |
print 'This transaction is success" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment