Paul Rubin writes: > Ben Finney writes: >> I'm not sure I know exactly what behaviour you want (“C style” may mean >> different things to each of us). > > I thought he meant trunc-division, so -5 / 2 = -2 and -5 % 2 = -1. > Python specifies floor division but C leaves it unspecified, I thought.
I found a statement that it's specified to be truncating since C99. Before that it was flooring or truncating. Reading OP's code, the intention seemed clear to me. -- https://mail.python.org/mailman/listinfo/python-list