Message77967
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) |
|
Date |
User |
Action |
Args |
2008-12-17 15:21:13 | pitrou | set | recipients:
+ pitrou, loewis, collinwinter, gregory.p.smith, Rhamphoryncus |
2008-12-17 15:21:13 | pitrou | set | messageid: <1229527273.8.0.177245447541.issue4074@psf.upfronthosting.co.za> |
2008-12-17 15:21:13 | pitrou | link | issue4074 messages |
2008-12-17 15:21:12 | pitrou | create | |
|