[Python-ideas] division oddness

Xavier Ho contact at xavierho.com
Thu May 6 21:33:16 EDT 2010


On Fri, May 7, 2010 at 11:13 AM, Chris Rebert <pyideas at rebertia.com> wrote:

> On Thu, May 6, 2010 at 5:43 PM, Mathias Panzenböck
> <grosser.meister.morti at gmx.net> wrote:
> > Shouldn't by mathematical definition -x // y be the same as -(x // y)?
> > I think this rather odd. Is there any deeper reason to this behaviour? I
> > guess changing this will break a lot of code, but why does it behave like
> > this?
>
> I would suppose it's what programmers have found more
> useful/intuitive. Most programmers aren't number theorists.
>

Yeah, I was stinged by that before, too. I really don't find it intuitive at
all - to keep the modulos remainer equal, you lose on negations and possibly
integer equality. Ah well, too bad I didn't invent Python. =].

Cheers,
Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100507/ab96fc86/attachment.html>


More information about the Python-list mailing list