How does CO_FUTURE_DIVISION compiler flag get propagated?

Hrvoje Niksic hniksic at xemacs.org
Sat Jul 2 21:55:41 CEST 2011


Terry <twestley at gmail.com> writes:

> Future division ("from __future__ import division") works within
> scripts executed by import or execfile(). However, it does not work
> when entered interactively in the interpreter like this:
>
>>>> from __future__ import division
>>>> a=2/3

Are you referring to the interactive interpreter normally invoked by
just running "python"?  That seems to work for me:

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 2/3
0
>>> from __future__ import division
>>> 2/3
0.6666666666666666



More information about the Python-list mailing list