Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eq=False to node classes #1500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add eq=False to node classes #1500

wants to merge 1 commit into from

Conversation

plypaul
Copy link
Contributor

@plypaul plypaul commented Nov 4, 2024

This sets eq=False for node dataclasses as nodes should be unique, and equivalence methods should be used for checking as the nodes represent recursive data structures. Without this, comparisons or using nodes as keys can be slow as the generated equals function will traverse the recursive structure.

This sets `eq=False` for node dataclasses as nodes should be unique, and
equivalence methods should be used for checking as the nodes represent
recursive data structures. Without this, comparisons or using nodes as keys
can be slow as the generated equals function will traverse the recursive
structure.
@cla-bot cla-bot bot added the cla:yes label Nov 4, 2024
@plypaul plypaul marked this pull request as ready for review November 4, 2024 17:06
@@ -57,7 +57,7 @@ def visit_node(self, node: DagNode) -> VisitorOutputT: # noqa: D102
DagNodeT = TypeVar("DagNodeT", bound="DagNode")


@dataclass(frozen=True)
@dataclass(frozen=True, eq=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a comment here explaining essentially what you explained in the PR description? Will likely be helpful to future devs.

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