I was looking through the source and learned that Python's modulo operator is based on floor-division (rather than round-toward-0 division like in C). In case anyone cares how Python actually does in in C, for small ints its defined at https://github.com/python/cpython/blob/master/Objects/longob...