summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-13 06:10:33 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 06:43:11 (GMT)
commit91b09b09db0c24a6dc6dc8239d2ea40be2784568 (patch)
tree20f4a62ab9899fa59d72e6a7868320b5a0ab754a
parent5eda0a6464e00774d31c502ecfa865b5a07a3c7a (diff)
IntDict gets __str__
-rw-r--r--src/common.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common.py b/src/common.py
index b164421..1c62d60 100644
--- a/src/common.py
+++ b/src/common.py
@@ -392,6 +392,12 @@ class IntDict(defaultdict, StrMixin):
self.parent[key] -= value
defaultdict.clear(self)
+ def __str__(self):
+ """sort the result for better log comparison"""
+ keys = sorted(self.keys())
+ return ', '.join('{}:{}'.format(
+ str(x), str(self[x])) for x in keys)
+
def __unicode__(self):
"""sort the result for better log comparison"""
keys = sorted(self.keys())