
March 13, 2020
8:14 a.m.
On 13/03/20 12:30 pm, Marco Sulla via Python-ideas wrote:
As you can see, Thing(abcd) has the same id of Thing(ab). So what Eric Wieser wanted is already implemented in Python, for temporary objects.
This is probably an accident. It's not really re-using an object, it's just that the object created for a+b+c+d happens to land in the same block of memory that was freed when a+b became unreferenced. It's not actually saving the cost of a memory allocation the way the numpy optimisation does. -- Greg