In python 2.7 using
from __future__ import division, print_function
Now I have a print(1/2)showing 0.5.
However, is it possible to import automatically when python starts up?
I tried to use a special module sitecustomize.py, but inport is valid only inside the module, and not in the shell.
As I'm sure, people will ask why I need this: teaching Python to teens, I noticed that integer separation was not easy for them, so we decided to switch to Python 3. However, one of the requirements of the course was to be able to build a function and Matplotlib is pretty good, but only applicable for Python 2.7.
So, my idea was to use a custom installation of 2.7 ... not perfect, but I have no better idea of having both Matplotlib and the new "natural" split of "1/2 = 0.5".
Any advice or alternative to Matplotlib working on python 3.2?
source
share