Created
November 18, 2016 15:31
-
-
Save ryanwilsonperkin/1ed0efe5f79b43bc57ab72e53f758a72 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
# Having fun with context managers | |
from contextlib import contextmanager | |
@contextmanager | |
def deity(): | |
print 'The Father' | |
yield | |
print 'The Holy Ghost' | |
god = deity() | |
with god as my_witness: | |
print 'The Son' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment