[New-bugs-announce] [issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative
Anthony Flury
report at bugs.python.org
Mon Apr 5 17:49:56 EDT 2021
New submission from Anthony Flury <anthony.flury at btinternet.com>:
The behavior of a%b when a is positive and b is negative can be suprising.
I understand that the behavior is so that the identity
a = (a//b)*b + a%b
can be preserved regardless of the signs of a or b.
but the result is different from other languages which is why it can be surprising.
I would be happy to do the grunt work to make the changes if some can suggest where.
Do we - add a warning to the https://docs.python.org/3/tutorial/introduction.html#numbers page, or should we link to a new page that details and explains the behavior. Which is more 'pythonic' in terms of documentation ?
----------
messages: 390264
nosy: anthony-flury
priority: normal
severity: normal
status: open
title: Documentation of modulo operator should document behaviour clearly when second operator is negative
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43737>
_______________________________________
More information about the New-bugs-announce
mailing list