You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(well the stdlib's version has additionally some handling when most_common() fails due to unorderable values, but you get the idea) but I'm not sure how to make this work on Py3.5.
The text was updated successfully, but these errors were encountered:
I think this sounds good. I believe we'll need to extract logic from pretty_dict to a utility function that takes an iterable of key-value pairs instead of a dict, called something like pretty_dict_from_pairs so that we can use that function both here and in the implementation of pretty_dict. This will ensure Python 3.5 can correctly render the output in the most common order. Then the actual pretty printer for Counter can be implemented as
Description
PrettyPrinter does not sort Counter()s entries by count, unlike
Counter.__str__
which explicitly does so.What I Did
I think the sorted form is clearly more useful (well, at least, it matches the intent of whoever wrote the stdlib's
Counter.__str__
).On Py3.6+ I think it's just a matter of
(well the stdlib's version has additionally some handling when most_common() fails due to unorderable values, but you get the idea) but I'm not sure how to make this work on Py3.5.
The text was updated successfully, but these errors were encountered: