Please help. Questions based on snippet of code below.Please post code that works. Use cut and paste.
1) when myTestCase is deleted, is just the pointer deleted or theHave you read the manual section on the del statement?
entire instance with all of its data and data structure deleted?
2) What is the practice for deleted the object and recovering theMost programs use del rather sparingly. Most temporary objects are
memory it occupies?
created within functions and get unbound automatically when the function
exits. If you need to guarantee release of external resources before
the program ends, make explict calls to .close methods of the instances
that connect to them. Actually memory recovery depends on the
implementation and version. I would not worry about this until you
really need to.
3) If delete is the way, what happens toObjects will not be destroyed while still reachable from code (in the
‘testUtils.utilFunction1()’ if it were instantiated in other classes
that have not been deleted yet?
absence of a severe bug).
import testUtils
class testClass:
def __init__(self):
self.testList = list()
self.testDict1 = dict()
self.utils1 = testUtils.utilFunction1()
myTestCase = testClass()Don't indent main body code.
delete myTestCase
Do use legal keywords.
tjr