[Python-ideas] integer dividion in R

Chris Rebert pyideas at rebertia.com
Fri May 7 09:38:49 CEST 2010


2010/5/7 spir ☣ <denis.spir at gmail.com>:
> Hello,
>
>
> The following point came up on the python-tutor mailing list:
>
> spir at o:~$ python
> Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> 4//3
> 1
>>>> -4//3
> -2
>
> The algorithm seems to use floor, not integral part. Is this correct, according to the (math) definition of integer division?

There was *literally* just a thread about essentially the same thing:
http://mail.python.org/pipermail/python-ideas/2010-May/007170.html

Short answer: Yes, because there are multiple valid ways to define
integer quotient and modulo.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-ideas mailing list