Skip to content

Instantly share code, notes, and snippets.

@goyalrohit
Created February 1, 2018 10:15
Show Gist options
  • Save goyalrohit/764b70f88b40686c2e3a2ff836ba4655 to your computer and use it in GitHub Desktop.
Save goyalrohit/764b70f88b40686c2e3a2ff836ba4655 to your computer and use it in GitHub Desktop.
class LoggingContextManager:
def __enter__(self):
print('LoggingContextManager.__enter__()')
return "You are in a with block"
def __exit__(self, exc_type, exc_val, exc_tb):
print('LoggingContextManager.__exit__({},{},{})'.format(exc_type, exc_val, exc_tb))
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment