Created
September 28, 2013 00:57
-
-
Save ironpythonbot/6737210 to your computer and use it in GitHub Desktop.
CodePlex Issue #18722 Plain Text Attachments
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
from System import GC | |
class C(object): | |
_instance = None | |
def __new__(cls): | |
if C._instance is None: | |
C._instance = object.__new__(cls) | |
return C._instance | |
def __del__(self): | |
print 'deleting object with id', id(self) | |
c = C() | |
print 'created a C with id', id(c) | |
d = C() | |
print 'created another C with id', id(d) | |
for _ in range(3): | |
GC.Collect() | |
GC.WaitForPendingFinalizers() | |
print id(c), id(d) | |
print c | |
print d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment