This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients docs@python, mark.dickinson
Date 2020-02-02.14:17:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The documentation[1] for comparisons between mixed types says:

> [...] when a binary arithmetic operator has operands of different
> numeric types, the operand with the "narrower" type is widened to
> that of the other, where integer is narrower than floating point,
> which is narrower than complex. Comparisons between numbers of
> mixed type use the same rule.

That "use the same rule" part of the last sentence is misleading: it suggests that (for example) when an int is compared with a float, the int is first converted to a float, and then the two floats are compared. But that's not what actually happens: instead, the exact values of the int and float are compared. (And it's essential that equality comparisons happen that way, else equality becomes intransitive and dictionaries with numeric keys get very confused as a result.)

I suggest dropping the last sentence and adding a new paragraph about comparisons between numbers of mixed type.

Date User Action Args
2020-02-02 14:17:34mark.dickinsonsetrecipients: + mark.dickinson, docs@python
2020-02-02 14:17:34mark.dickinsonsetmessageid: <>
2020-02-02 14:17:34mark.dickinsonlinkissue39530 messages
2020-02-02 14:17:34mark.dickinsoncreate