- self.items.append("+ " + more + " more")
-
- def orderbyfreq(self): # order a list by the frequency of its elements and remove duplicates
-# temp = list(self.items)[:]
-# logger.debug(self.items)
-# self.items = list(set(self.items))
-# self.items = [[i, temp.count(i)] for i in self.items] # add count of each element
-# self.items.sort(key=lambda x:temp.count(x[0])) # sort by count
-# self.items = [i[0] + ' (' + str(i[1]) + ')' for i in self.items] # put element and count into string
-# self.items = self.items[::-1] # reverse
+ self.items.append("+ {0} more".format(more))
+
+ def orderbyfreq(self):
+ """
+ Order a list by frequency of each item, then remove duplicates and append frequency in parentheses.
+ """