We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 045230d commit ec98b3cCopy full SHA for ec98b3c
1 file changed
curtsies/formatstring.py
@@ -157,7 +157,10 @@ def __eq__(self, other):
157
if not isinstance(other, Chunk):
158
return False
159
return self.s == other.s and self.atts == other.atts
160
- # TODO: corresponding hash method
+
161
+ def __hash__(self):
162
+ # type: () -> int
163
+ return hash(self.s, self.atts)
164
165
if PY3:
166
__str__ = __unicode__
@@ -524,7 +527,10 @@ def __eq__(self, other):
524
527
if isinstance(other, (unicode, bytes, FmtStr)):
525
528
return str(self) == str(other)
526
529
- # TODO corresponding hash method
530
531
532
533
+ return hash(str(self))
534
535
def __add__(self, other):
536
# type: (Union[FmtStr, Text]) -> FmtStr
0 commit comments