E
Elbert Lev
Please correct me if I'm wrong.
Python (as I understand) uses reference counting to determine when to
delete the object. As soon as the object goes out of the scope it is
deleted. Python does not use garbage collection (as Java does).
So if the script runs a loop:
for i in range(100):
f = Obj(i)
Every time f = Obj(i) is executed it is preceded by f.__del__() call.
Is the same true for functions like:
def A():
f1 = Obj(1)
f2 = Obj(2)
Are f1 and f2 deleted before returning from A?
If my assumptions are correct, tell me please: can I expect that no
garbage collection will be used in the future and Python will use
reference counting?
Python (as I understand) uses reference counting to determine when to
delete the object. As soon as the object goes out of the scope it is
deleted. Python does not use garbage collection (as Java does).
So if the script runs a loop:
for i in range(100):
f = Obj(i)
Every time f = Obj(i) is executed it is preceded by f.__del__() call.
Is the same true for functions like:
def A():
f1 = Obj(1)
f2 = Obj(2)
Are f1 and f2 deleted before returning from A?
If my assumptions are correct, tell me please: can I expect that no
garbage collection will be used in the future and Python will use
reference counting?