1/2 evaluates to 0

Noah Hall enalicho at gmail.com
Wed Oct 12 07:41:05 EDT 2011


On Wed, Oct 12, 2011 at 12:28 PM, Laurent <moky.math at gmail.com> wrote:
>
>> Include from __future__ import division on the top of your file
>>
>>>>>  from __future__ import division
>>>>>  1/2
>>
>> 0.5
>>
>
> Wohaw. This means that this behavior is going to be default in a foreseeable
> future ?

Never in Python 2.x, but it already is in Python 3.x [1]

[1] - http://www.python.org/dev/peps/pep-0238/



More information about the Python-list mailing list