On Thu, 12 Mar 2020 at 19:10, Andrew Barnert <abarn...@yahoo.com.via.e4ward.com> wrote: > No, because the return value only lives until (effectively) the end of the > statement. A statement has no value, so the effect of an expression statement > is to immediately discard whatever the value of the expression was. (In > CPython this is an explicit stack pop.) > > Except for the case of interactive mode, of course, where an expression > statement binds the value to the _ variable.
Okay, so it seems I was confused by the REPL feature. Anyway, since the object is not discarded until the expression statement ends, it has no effect on speed. On the contrary, for what I have read, the numpy patch removes the temporary ndarrays immediately. This speeds up calcula with large ndarrays. So there's no need to change the `del` behaviour. Python could implement something similar to the numpy patch for large immutables. The problem is: how? _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/Y7ZKSFALESRP6VD5SJZQNG7ZI4QMUFFW/ Code of Conduct: http://python.org/psf/codeofconduct/