`~/.pythonrc' `from __future__ import'

François Pinard pinard at iro.umontreal.ca
Sun Jul 7 18:12:15 EDT 2002


Hello, people.  Here is a strange problem with `from __future__ import',
maybe you can help me understand it.  This is with Python 2.2.1.

Given `export PYTHONSTARTUP=/home/pinard/etc/pythonrc', and that `pythonrc'
file starting with:

---------------------------------------------------------------------->
from __future__ import division
print 3/4
----------------------------------------------------------------------<

then I interactively get:

---------------------------------------------------------------------->
18:01 0 pinard at titan:~ $ python
Python 2.2.1 (#1, Apr 29 2002, 14:27:21) 
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
0.75
>>> 3/4
0
>>> from __future__ import division
>>> 3/4
0.75
----------------------------------------------------------------------<

I wonder why I have to re-execute `from __future__ import divsion'
interactively before it works.  How should I proceed to activate this
option once and for all for interactive applications?

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list