My web surfing reveals that the underscore variable _
should contain the result of the last REPL statement. This is what I get instead
>>> 2+7
Out[89]: 9
>>> _
Traceback (most recent call last):
Cell In[90], line 1
_
NameError: name '_' is not defined
Is this supposed to be supported?
I am using Spyder 5.4.3 on Windows 10 with Python 3.9, all installed via Anaconda.
It seems that if I assign a function return argument to variable _
[1], the REPL ceases to assign the last result to _
. Issuing del _
doesn't seem to restore the default behaviour of repeatedly having the last result assigned to _
.
Notes
[1] I found on Stack Overflow that this is one way to disregard selected return arguments when a function returns multiple results. However, there was debate on the advisability of doing this.