Earlier quoted context omitted.
> Makes for horrible footguns like: > history[counter % SIZE] = … The footgun here is that the “modulo” operator does not actually calculate the modulo in C. In Python, this works correctly for negative values.
> In Python, this works correctly for negative values. They’re both “broken” in different ways. Arguably C’s brokenness is more apparent and less useful but Python also has footguns: C uses truncated division for its “modulo” so the remainder has the sign of the dividend, Python uses floored division so the remainder has the sign of the divisor instead. The wiki page for modulo has a pretty extensive page on the subj…
Serious question, how is that a footgun? In decades of software development I have never needed a negative divisor for modulo. What would you use it for?