[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

Anthony Flury report at bugs.python.org
Tue Apr 6 06:14:41 EDT 2021


Anthony Flury <anthony.flury at btinternet.com> added the comment:

I take your point about warnings etc - but when you come from other languages the Python behavior can initially be very surprising.

The reference section has always seemed to be a very technical document, certainly not targeted at the usual audience of people using Python.

Most Python users don't consider that int/float etc would be in the standard library either - for most users the built-ins are not the same.

Can I suggest:

1) The identity that is mentioned on https://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations should be made more clear - at the moment it is buried in a paragraph and easily missed.

2) The document https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex should also mention the identity and the need to preserve it.

3) A link fromhttps://docs.python.org/3/tutorial/introduction.html#numbers to the document https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex - the introductory tutorial should link to further detail where neccessary.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43737>
_______________________________________


More information about the Python-bugs-list mailing list