Created
June 25, 2014 12:25
-
-
Save Pycz/2a3c19f393b115d6f56c 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 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