[GRASS-dev] gis.py:801: DeprecationWarning: classic int division

Anna Petrášová kratochanna at gmail.com
Sat May 2 06:21:31 PDT 2015


On Sat, May 2, 2015 at 8:13 AM, Nikos Alexandris <nik at nikosalexandris.net>
wrote:

> I just ran
>
> python -Qwarn -tt -3
>
> on a custom python script and the first line returned is
>
> gis.py:801: DeprecationWarning: classic int division
>
> Is this something that needs to be fixed?
>

in Python 2 :

1 / 2
results in 0, that's 'classic int division'

in Python 3 it results in 0.5

so it warns you that you are using 'classic int division' so in Python 3
this will change result. So depending on what you want, either use

float(1)/2

or to keep the integer division

from __future__ import division

1//2

>
> Nikos
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20150502/3d646477/attachment.html>


More information about the grass-dev mailing list