Skip to content

Conversation

Aniketsy
Copy link

@Aniketsy Aniketsy commented Sep 16, 2025

#138991
This PR updates the documentation for the eq parameter in the dataclasses module to reflect the new field-by-field comparison behavior introduced in Python 3.13.
A .. versionchanged:: 3.13 notice has been added, and the previous tuple-based comparison for Python 3.12 and earlier is described for clarity.

Additionally, new tests have been added to verify the updated __eq__ implementation, including field-by-field comparison, type checking, and custom field equality logic.

Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thankyou !


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

@bedevere-app

This comment was marked as resolved.

generated.

.. versionchanged:: 3.13
The generated ``__eq__`` method now compares each field individually (e.g., ``self.a == other.a and self.b == other.b``), rather than comparing tuples of fields as in previous versions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please wrap lines to 79 characters.

Also, please don't use Latin abbreviations, see the devguide for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants