Recall last result

Fernando Perez fperez528 at yahoo.com
Mon Jun 9 19:31:45 EDT 2003


Erich Neuwirth wrote:

> Is there a standard way of recalling the last result?
> Following situation:
> I call a function producing a large solution
> for a combinatorial problem. The computation takes quite some time.
> I forgot to assign the result to a variable.
> The list is displayed on screen?
> Now i want to count the number of elements in
> the solution list.
> Can i access the result of the last computation in a goboal vaiable?
> 
> History recall does not help me, since that would reproduce my input,
> but I need the output.
> 
> I tried to find the answer in the docs, but could not find it.
> Is there a FAQ dealing with questions like this one?

Try ipython (http://ipython.scipy.org).  It's an interactive shell which
remembers all output in variables named _NNN, where NNN is a numeric identifier
which increases with each new prompt.  

You are likely to be familiar with mathematica, so you should feel right at
home: ipython's prompt system is inspired by mathematica's use of %, %%, %NNN
for recalling previous results.

Best,

f.

ps.  ipython has many other features intended to make interactive use much more
efficient than with the default interpreter.




More information about the Python-list mailing list