When I instantiate an object in a loop without assigning it to any variable, I thought it would create new object for each iteration. But the code below seems to indicate we reuse the same object.
Can someone explain why this is happening? Smart GC logic or interpreter optimization?
for x in range(10):
print(id(TestClass()))
# output
140640390008776
140640390008776
140640390008776
140640390008776
140640390008776
140640390008776
140640390008776
140640390008776
140640390008776
140640390008776