On Fri, Mar 18, 2022 at 12:09 PM Nathan Levett <nathan.levett.93@gmail.com> wrote:
Howdy python gang,

First time posting here ~ I've recently encountered that python does not have an OOTB operator for modulo that is consistent with Euclidean division.

Are you referring to something different than the divmod builtin?

>>> help(divmod)
Help on built-in function divmod in module builtins:

divmod(x, y, /)
    Return the tuple (x//y, x%y).  Invariant: div*y + mod == x.

André

 
Although it should be easy for anyone who wants this to create it themselves, it struck me as odd that it was not an already included feature. I was even more shocked to see a list indicating that most languages don't include one consister with Euclidean division (disheartening to realise that the number theory way of doing things is not the default). I was so shocked at it's lack from python that it motivated me to post this, I suppose!

I guess I'm posting to check how open anyone would be to the idea? I'm not sure if '%%' is defined anywhere, but it seemed like an intuitive suggestion if not already used as an operator, parallel to the syntax of the '**' operator.

Keen to know how open y'all're to it!
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/KRISFMIOXQOXFH5Y4XYUMBEONMCCOOQH/
Code of Conduct: http://python.org/psf/codeofconduct/