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

Iris cubes and coordinates are both mutable and hashable #962

Closed
shoyer opened this issue Jan 17, 2014 · 5 comments
Closed

Iris cubes and coordinates are both mutable and hashable #962

shoyer opened this issue Jan 17, 2014 · 5 comments
Labels
Stale A stale issue/pull-request

Comments

@shoyer
Copy link
Contributor

shoyer commented Jan 17, 2014

This break Python conventions and thus is likely to lead to unexpected behavior.

This is especially problematic because these objects also implement their own __eq__ method, and thus hashes for equal objects are not necessary equal.

For an overview, read the answers on this StackOverflow question:
http://stackoverflow.com/questions/2671376/hashable-immutable

Since it's unlikely that cubes or coords can be made entirely immutable, my suggested fix is to add __hash__ = None to both Coord and Cube.

@rhattersley
Copy link
Member

👍

@pelson
Copy link
Member

pelson commented Oct 24, 2017

Got done in #1772 I believe.

@pelson pelson closed this as completed Oct 24, 2017
@djkirkham
Copy link
Contributor

djkirkham commented Oct 24, 2017

It's still an issue. For both Cubes and Coords, __eq__ is based on mutable properties of the object, which implies they shouldn't be hash-able. Unless we make Cubes and Coords immutable, we shouldn't really be using them in sets or as dictionary keys.

@djkirkham djkirkham reopened this Oct 24, 2017
@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2021

In order to maintain a backlog of relevant issues, we automatically label them as stale after 500 days of inactivity.

If this issue is still important to you, then please comment on this issue and the stale label will be removed.

Otherwise this issue will be automatically closed in 28 days time.

@github-actions github-actions bot added the Stale A stale issue/pull-request label Aug 6, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2021

This stale issue has been automatically closed due to a lack of community activity.

If you still care about this issue, then please either:

  • Re-open this issue, if you have sufficient permissions, or
  • Add a comment pinging @SciTools/iris-devs who will re-open on your behalf.

@github-actions github-actions bot closed this as completed Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale A stale issue/pull-request
Projects
None yet
Development

No branches or pull requests

4 participants