Skip to content

Commit

Permalink
Also implement __hash__ for tagged union members
Browse files Browse the repository at this point in the history
  • Loading branch information
Carotti committed Jun 24, 2019
1 parent e307146 commit 1075fd2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -13,7 +13,7 @@ install:
- pip install -r requirements-dev.txt
- pip install .
script:
- pylint tagged_union
- pylint tagged_union --py3k
- pytest --cov=tagged_union
after_success:
- coveralls
Expand Down
3 changes: 3 additions & 0 deletions tagged_union/__init__.py
Expand Up @@ -87,6 +87,9 @@ def __repr__(self):
def __eq__(self, other):
return (self.name, self.args) == (other.name, other.args)

def __hash__(self):
return hash((self.name, self.args))

class TaggedUnionMemberFactory:
"""Helper class for creating tagged union members.
Expand Down

0 comments on commit 1075fd2

Please sign in to comment.