Created
June 25, 2014 12:25
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
class Monk(object): | |
monk = None | |
def __call__(self): | |
if not self.monk: | |
self.monk = Monk() | |
return self.monk | |
a = Monk() | |
print a | |
print a | |
print a | |
print a() | |
print a() | |
print a() | |
print a()() | |
print a()() | |
print a()() | |
print a()()() | |
print a()()() | |
print a()()() | |
<__main__.Monk object at 0xb74be16c> | |
<__main__.Monk object at 0xb74be16c> | |
<__main__.Monk object at 0xb74be16c> | |
<__main__.Monk object at 0xb74be1ac> | |
<__main__.Monk object at 0xb74be1ac> | |
<__main__.Monk object at 0xb74be1ac> | |
<__main__.Monk object at 0xb74be1cc> | |
<__main__.Monk object at 0xb74be1cc> | |
<__main__.Monk object at 0xb74be1cc> | |
<__main__.Monk object at 0xb74be1ec> | |
<__main__.Monk object at 0xb74be1ec> | |
<__main__.Monk object at 0xb74be1ec> | |
[Finished in 0.0s] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment