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

Differentiate order in Expression equality function #1080

Merged
merged 1 commit into from
May 12, 2020

Conversation

kitchoi
Copy link
Contributor

@kitchoi kitchoi commented May 12, 2020

This PR makes trait("a") | trait("b") to be considered as NOT equivalent to trait("b") | trait("a"). Strictly speaking, this is true because the given change handler will be registered to "a" first and then to "b" when observe(handler, trait("a") | trait("b")) is called. When observe(handler, trait("b") | trait("a")) is called, the change handler will be registered to "b" first and then to "a".

The __eq__ is not used by the internal machinery, it is there to help users learning the expression. Internal observe machinery uses _as_graphs instead. So if the users want to see these two being considered equal, we can change this back without affecting anything.

Checklist

  • Tests
  • Update API reference (docs/source/traits_api_reference): autodoc handled this.
  • Update User manual (docs/source/traits_user_manual): Does not exist yet.
  • Update type annotation hints in traits-stubs

@kitchoi kitchoi changed the title Differentiate order in equality Differentiate order in Expression equality function May 12, 2020
Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

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

LGTM

@kitchoi kitchoi merged commit c3af7af into master May 12, 2020
@kitchoi kitchoi deleted the expression-eq-to-keep-order branch May 12, 2020 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants