decimal numbers

Frank Millman frank at chagford.com
Sat Feb 15 11:56:25 CET 2014


"Frank Millman" <frank at chagford.com> wrote in message 
news:ldngnf$c3r$1 at ger.gmane.org...
>
> "Luke Geelen" <luke.geelen at gmail.com> wrote in message 
> news:ae0da085-6c41-4166-92d2-92611a990885 at googlegroups.com...
>> Op zaterdag 15 februari 2014 11:04:17 UTC+1 schreef Frank Millman:
>>> "Luke Geelen" <luke.geelen at gmail.com> wrote in message
>>>
>>> news:ec88852e-1384-4aa5-834b-85135be94ab9 at googlegroups.com...
>>>
> [...]
>>>
>>> You can reproduce the python3 behaviour in python2 by adding a 'future' 
>>> directive -
>>>
>>> >>> from __future__ import division
>>>
>>> >>> 10/3
>>>
>>> 3.3333333333333335
>>>
>>
>> how (and where) would i add this rule into a script? by import or the 
>> calculation?
>
> Treat it like any other import - add it as a new line at the top of your 
> script.
>

Actually I did not answer that very accurately. From the documentation -

"""
A future statement must appear near the top of the module. The only lines 
that can appear before a future statement are:

    the module docstring (if any),
    comments,
    blank lines, and
    other future statements.
"""

Frank






More information about the Python-list mailing list