Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Erasing Python Objects

Status
Not open for further replies.

thegman

Programmer
Oct 16, 2001
26
GB
How is it possible to delete an object on Python, other than use 'del', as I understand that this deincrements the reference count to the object, rather than erase the object itself, I need to erase objects completely, how is this done? I know that if I delete all the references then the object will cease to exist, but this seems like a round-about way to do it.

TIA

Garry
 
You can use the None trick:

myvar = None

Note that this will not erase the object from memory.
You do not have control over the garbage collector (well - the reference counter), but I don't knnow if you can force to garbage collector to collect.

Maybe in the garbage collector module ? (gc):
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top