
On Thu, 12 Mar 2020 at 19:35, Chris Angelico <rosuav@gmail.com> wrote:
I don't understand your point.
Yes, Andrew Barnert already explained me that :)
The broad idea of "del x" returning a value isn't inherently ridiculous
The point is Eric Wieser does not really want this. What he want is something similar to the numpy patch he linked: https://github.com/numpy/numpy/pull/7997 that is an automatic delete of temporary, large objects. For example: z = a + b + c + d will create a temporary (a+b) object and a temporary (a + b) + c object. With that patch, if a, b, c and d are all ndarrays, the temporary objects are discard as soon as they are no more referenced, instead of at the end of the statement. He thought that the change of `del` he proposed will give him that behavior, but this is not true. And I don't think it's very much simple to implement this feature for __all__ Python objects. Maybe for immutable ones, but it should be done one by one, I suppose, since there's not an "immutable iterface".