Skip to content

Conversation

@mohsinm-dev
Copy link
Contributor

@mohsinm-dev mohsinm-dev commented Nov 8, 2025

Summary

Fixes issue #141218 by correcting inaccurate documentation about object comparison.

Problem: The current documentation states "Objects of different types, except different numeric types, never compare equal" which is factually incorrect.

Counter-example:

>>> frozenset([1, 2]) == {1, 2}
True

Solution: Changed to "Objects of different types, unless documented otherwise, never compare equal" to account for all documented exceptions.

Documented exceptions include:

  • Numeric types (int, float, complex) - already mentioned
  • set/frozenset comparisons - documented later in same file
  • dict subclass comparisons (defaultdict, Counter, OrderedDict)

Changes

  • Updated Doc/library/stdtypes.rst line 167
  • Added news entry in Misc/NEWS.d/next/Documentation/

Test plan

  • Documentation builds successfully with make html
  • Verified change maintains consistency with existing specific type documentation
  • Tested that the issue examples work as described
  • Confirmed change is minimal and maintains readability

The fix improves documentation accuracy while maintaining clarity and consistency.


📚 Documentation preview 📚: https://cpython-previews--141221.org.readthedocs.build/

Changed "Objects of different types, except different numeric types, never
compare equal" to "Objects of different types, unless documented otherwise,
never compare equal" to account for documented exceptions like set/frozenset
comparisons.
@python-cla-bot
Copy link

python-cla-bot bot commented Nov 8, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@skirpichev
Copy link
Contributor

I suggest just revert news. Its usually not required for docs changes.

@skirpichev skirpichev added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants