Ian Kelly <ian.g.ke...@gmail.com>:

> On Sat, Apr 19, 2014 at 1:34 AM, Chris Angelico <ros...@gmail.com> wrote:
>> if you're going to move to Python 3, you may as well have your code
>> start working that way, so you get used to typing // to divide
>> integers and get an integer (floor division).
>
> [...]
>
> We also gained a consistent and explicit way to differentiate between
> the two different styles of division that classic division
> represented, as opposed to picking at run-time based on type.

Very often when integer division is needed, so is the remainder. Then,
it is good to remember the builtin divmod() function:

   https://docs.python.org/3.4/library/functions.html#divmod

In fact, divmod() goes a long way toward removing the need for // and %
in Python code.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to