Skip to content

Commit

Permalink
implement hash special method in Ext class
Browse files Browse the repository at this point in the history
allowing Ext objects to be used as map keys.
  • Loading branch information
Fabien Fleutot authored and vsergeev committed Mar 20, 2017
1 parent b7bdf03 commit 4c461ed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions umsgpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ def __str__(self):
s += ")"
return s

def __hash__(self):
"""
Provide a hash of this Ext object.
"""
return hash((self.type, self.data))


class InvalidString(bytes):
"""Subclass of bytes to hold invalid UTF-8 strings."""
pass
Expand Down

0 comments on commit 4c461ed

Please sign in to comment.