[IPython-user] [beginner] problem with _

Paul Ivanov pivanov314@gmail....
Sat Nov 22 14:25:51 CST 2008


Hi David,

The problem is just that ball_variables.py does not return 1.2342 - it
simply prints it (that's why there was no 'Out[1]: ' in front of it.

try this to check if _ is working properly:

In [1]: 1.2342
Out[1]: 1.2342

In [2]: _*10
Out[2]: 12.341999999999999

If this example works for you, then you just need to add a return
statement to ball_variables.py, something like this:

print 5*0.6 - 0.5*9.81*0.6**2
return 5*0.6 - 0.5*9.81*0.6**2

cheers,
Paul Ivanov

David, on 2008-11-22 08:02, wrote:
> Hello list,
> 
> I am just beginning teaching myself IPython, and I am stumbling.
> Following the steps in a book on Computer Programming (Langtangen), the 
> author gives the following example:
> 
> In [1]: run ball_variables.py
> 1.2342
> 
> In [2]: _*10
> Out[2]: 12.341999999999999
> 
> 
> That is, he argues that with an underscore "_" the last result can be 
> accessed.
> However, I cannot reproduce this behaviour. I am running
> Python 2.5.2 (r252:60911) with IPython 0.8.1.
> 
> Could someone please be so kind and let me know what the mistake is?
> 
> Cheers,
> 
> David
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-user



More information about the IPython-user mailing list