Created
September 4, 2016 21:41
-
-
Save avamsi/a05cca98a5e26333280e2ec255ba9ef3 to your computer and use it in GitHub Desktop.
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 JustAnotherClass(object): | |
_sentinel = object() | |
def __init__(self, value): | |
self.value = value | |
def consume1(self): | |
try: | |
return self.value | |
finally: | |
self.value = self._sentinel | |
def consume2(self): | |
_value = self.value | |
self.value = self._sentinel | |
return _value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment