Created
June 22, 2011 09:33
-
-
Save patrys/1039760 to your computer and use it in GitHub Desktop.
Implements the awesome pattern
This file contains 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 Barney(object): | |
def __enter__(self): | |
print 'legen...' | |
def __exit__(self, exc_type, exc_value, traceback): | |
print '...dary' | |
with Barney(): | |
print 'wait for it' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment