[IPython-dev] from __future__ import division
Fernando Perez
fperez.net at gmail.com
Wed Jun 14 17:37:31 EDT 2006
On 6/14/06, Darren Dale <dd55 at cornell.edu> wrote:
> Fernando, didnt you change ipython's pylab mode to support the new division
> operation by default, or did I imagine that?
Thanks for jolting my memory. The full thread on this matter is here:
http://scipy.net/pipermail/ipython-user/2005-December/001183.html
To summarize things out, the trick is this one. In your ipythonrc
file, add (put this in ONE LINE, the gmail client splits it):
execute exec __IP.compile('from __future__ import
division','<input>','single') in __IP.user_ns
The behavior is not the default in ipython, but it's easy enough for
users to activate.
Note that trying to start ipython with a -Qnew interpreter crashes
pylab, because numpy is NOT new-division safe:
planck[contrib]> python -Qnew `which ipython`
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
Type "copyright", "credits" or "license" for more information.
IPython 0.7.2 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: from numpy import *
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most
recent call last)
/home/fperez/ipython/contrib/<ipython console>
/usr/lib/python2.3/site-packages/numpy/f2py/__init__.py
9 from info import __doc__
10
---> 11 import f2py2e
12 run_main = f2py2e.run_main
13 main = f2py2e.main
/usr/lib/python2.3/site-packages/numpy/f2py/f2py2e.py
25
26 import crackfortran
---> 27 import rules
28 import cb_rules
29 import common_rules
/usr/lib/python2.3/site-packages/numpy/f2py/rules.py
94 #################### Rules for C/API module #################
95
---> 96 module_rules={
97 'modulebody':"""\
98 /* File: #modulename#module.c
/usr/lib/python2.3/site-packages/numpy/f2py/auxfuncs.py in gentitle(name)
393 def gentitle(name):
394 l=(80-len(name)-6)/2
--> 395 return '/*%s %s %s*/'%(l*'*',name,l*'*')
396 def flatlist(l):
397 if type(l)==types.ListType:
TypeError: can't multiply sequence to non-int
Cheers,
f
More information about the IPython-dev
mailing list