Author pitrou
Recipients Rhamphoryncus, collinwinter, gregory.p.smith, loewis, pitrou
Date 2008-12-17.15:21:11
SpamBayes Score 4.21077e-07
Marked as misclassified No
Message-id <1229527273.8.0.177245447541.issue4074@psf.upfronthosting.co.za>
In-reply-to
Content
This new patch also adds a function named gc.is_tracked() which returns
True if the object is tracked by the GC:

>>> import gc
>>> gc.is_tracked(1)
False
>>> gc.is_tracked([])
True
>>> gc.is_tracked(())
True
>>> gc.is_tracked((0,1))
False
>>> gc.is_tracked((0,"a"))
False
>>> gc.is_tracked((0,[]))
True
>>> gc.is_tracked((0,(1,2)))
False
>>> gc.is_tracked((0,(1,0.55)))
False
>>> gc.is_tracked((0,(1,{})))
True
>>> gc.is_tracked((None, True, False, "a", (1,2,u"z",("another",
"nested", u"tuple")), int))
False
>>> gc.is_tracked(gc)
True


(as you see the empty tuple is considered tracked, this is not important
since it is a singleton anyway)
History
Date User Action Args
2008-12-17 15:21:13pitrousetrecipients: + pitrou, loewis, collinwinter, gregory.p.smith, Rhamphoryncus
2008-12-17 15:21:13pitrousetmessageid: <1229527273.8.0.177245447541.issue4074@psf.upfronthosting.co.za>
2008-12-17 15:21:13pitroulinkissue4074 messages
2008-12-17 15:21:12pitroucreate