Created
April 19, 2018 19:53
-
-
Save lockie/7b86f1a85bdd5f6b44a0e8764b97401c to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
class Context(): | |
def __enter__(self): | |
print('__enter__') | |
def __exit__(self, *args): | |
print('__exit__') | |
def gen(): | |
with Context(): | |
yield 1 | |
for i in gen(): | |
print(i / 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment